A query to read the results of https://gist.github.com/joewiz/4ce1a564553d954855fe7500989afe22 and generate a report about function signature mismatches between the W3C XPath & XQuery Functions & Operators spec and eXist's implementation.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?xml version="1.0" encoding="UTF-8"?> | |
| <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" | |
| "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> | |
| <plist version="1.0"> | |
| <array> | |
| <dict> | |
| <key>ApplicationIdentifier</key> | |
| <string>ro.sync.exml.DiffDirs</string> | |
| <key>ApplicationName</key> | |
| <string>Diff Directories</string> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| xquery version "3.1"; | |
| (:~ | |
| Calculate Levenshtein Distance, using XQuery | |
| @author Guillaume Mella | |
| @see http://apps.jmmc.fr/~mellag/xquery/levenshtein/2018/01/19/xquery-levenshtein-distance/ | |
| :) | |
| declare function local:levenshtein-distance($string1 as xs:string?, $string2 as xs:string?) | |
| as xs:integer |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| xquery version "3.1"; | |
| declare namespace output="http://www.w3.org/2010/xslt-xquery-serialization"; | |
| declare option output:method "adaptive"; | |
| declare option output:indent "yes"; | |
| map { "reference": xs:anyURI("https://www.w3.org/TR/xslt-xquery-serialization-31/#adaptive-output") } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| xquery version "3.1"; | |
| (: | |
| Various Date String Parser | |
| - Parses various flavors of date strings, returns as xs:dateTime or xs:date | |
| - Key functions: dates:parseDateTime() and dates:parseDate() | |
| - Adapted by Joe Wicentowski from | |
| https://github.com/marklogic-community/commons/blob/master/dates/date-parser.xqy | |
| - Adapted to standard XQuery (instead of the MarkLogic 0.9-ml flavor) | |
| - TODO: test against https://github.com/marklogic-community/commons/blob/master/dates/date-parser-tests.xqy |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| xquery version "3.1"; | |
| (: Generate a TSV of Travels of President and Secretary of State. | |
| : Assumes https://github.com/HistoryAtState/travels has been installed. | |
| :) | |
| (:~ | |
| : A function for constructing a TSV (tab-separated value) file | |
| : | |
| : @param A sequence of column headings |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| xquery version "3.1"; | |
| (:~ A module containing a lookup table, in the form of a map, for HTML entities | |
| : that aren't defined in XML, and a function for converting HTML entities in | |
| : strings to the appropriate characters. Look up characters via map lookup: | |
| : | |
| : $entities:entities?ograve?character => ò | |
| : | |
| : @author Joe Wicentowski | |
| : @see https://en.wikipedia.org/wiki/List_of_XML_and_HTML_character_entity_references#Character_entity_references_in_HTML |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| xquery version "3.1"; | |
| declare namespace output = "http://www.w3.org/2010/xslt-xquery-serialization"; | |
| declare option output:method "html5"; | |
| declare option output:media-type "text/html"; | |
| let $title := "Gaps between appointments of Principal Officers" | |
| let $min-gap := xs:dayTimeDuration("P30D") | |
| let $positions := collection("/db/apps/pocom/positions-principals")/principal-position[not(id = ("ambassador-at-large", "career-ambassador"))] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| xquery version "3.1"; | |
| declare namespace fos="http://www.w3.org/xpath-functions/spec/namespace"; | |
| declare function local:writeHeader() as xs:string { | |
| ' | |
| xquery version "3.1"; | |
| module namespace xqfunctions="http://exist-db.org/xquery/test/xqfunctions"; |
This gist was prompted by a question on the eXist-open mailing list. See http://markmail.org/message/zudf7qp4pqjx6xhi.
To run these files:
- Download this gist as a .zip file
- Uncompress the .zip file
- Create collection
/db/testin eXist - Upload the contents of the zip file into the
/db/testcollection - Reindex
/db/testwithxmldb:reindex("/db/test") - Run
/db/test/test.xq