OpenLLM-France/wikimedia huggingface dataset:
# XQuery/Parsing CSV
## Motivation

You want to parse a file of comma-separated values (CSV) text into an xml structure or you have a flat file with very similar line/field structure that you want to convert into XML format.

## Method

We will use the tokenize($input, '\n') function to break the input file into separate lines. We will then use the tokenize($input, '\s*,\s*') function to parse each line into separate fields. The regexp term \s* will remove whitespace.

## Basic Example

Execute

### Sample Output
## Example With Data Dictionary in Row 1

This second example will use the first row of the CSV file as a data dictionary of the element names for each column of each row.
Execute

### Sample Output
## Adding Configuration File Options

Many times you have a family of CSV files that all may have very similar options for import. In this case it is useful to be able to pass a series of configuration parameters to a single XQuery function. These configuration parameters include:
* What the field delimiter is (comma is the default)
* The element name of the root node
* The element name of each line or row
You can then use this configuration file in the CSV parser:
Execute

## CSV complications

The code above assumes a simple form of CSV. In practice CSV must handle more complex cases for which as simple use of tokeniser is insufficient to parse a line. Strings containing one or more separators will be double-quoted. Quotes within quoted strings also need to be handled.
The following implementations handle some or all of these complications, although it is often not clear which complications are considered.
* XSLT 2.0 Stylesheet for transforming CSV files to XML
* Matthew Royal's parser Sadly this Marklogic only since it uses mutable maps.
* Zorba CSV importer
* BaseX CSV module
* David Cassel another Marklogic specific implementation

## Related work

* Adam Retter's work on CSV schemas and Validation
# XQuery/Open Search
## Motivation

You want to allow users to search your site using a tool such as the search boxes in the upper right corner of many web browsers. You want to publish your search interface using standardized documents.
Note that this has not been made to work yet. It is currently in development.

## Example of OpenSearch XML Configuration File

This file will tell the search tool to take the search terms out of the search text field and perform an HTTP get on the local XQuery on your default eXist running on your local system. If you change your hostname, port or path you just need to update the URL in the XML configuration file.
# XQuery/Overview of Page Scraping Techniques
## Motivation

You want a toolkit for pulling information out of web pages, even if those pages are not well formed XML files.

## Method

XQuery is an ideal toolkit for manipulating well-formed HTML; you need only use the doc function, e.g. doc('http://www.example.org/index.html') or doc('/db/path/to/index.html'). But, if a webpage is not well-formed XML, you will get errors about the source not being well-formed.
Luckily, there are programs that transform HTML files into well-formed XML files.
eXist provides several such tools. One is the httpclient module's get function, httpclient:get. To use this function you need to enable the httpclient module, by modifying the conf.xml file so that the module is loaded the next time you start eXist. Uncomment the following line:
For example the following example performs an HTTP GET on the list of all the feeds from the IBM web site:
Sometimes the HTML is so malformed that even httpclient:get will not be able to salvage the HTML. For example, if an element has two @id elements, you will get the error, "Error XQDY0025: element has more than one attribute 'id'". In this case, you may need to download the HTML source and clean up the HTML just enough so that eXist can parse the rest. Then, store the file in your database, and use the util:parse-html function (which passes the text through the Neko HTML parser to make it well-formed).
The following XQuery will clean up HTML (saved as text file, because it is still malformed):

## Testing your HTTP Client with an Simple Echo Script

Once you have the have the results in
Source code for echo.xq
# Overview of eXist search functions and operators

In catching up with updating from eXist-1.2.6 to eXist-1.4.x, one thing struck me. Despite eXist's elaborate documentation, I was feeling a bit lost in the myriad of overlapping search functions and their modalities (both default and fallback behaviours). I think I would feel helped with an overview grouping the different search-related functions in one place.
I don't know if this could be interesting to complete the eXist documentation; at this stage, however I'm not too sure about all functions, and maybe others may see more interesting approaches for such an overview. Therefore, I thought maybe the Wikibook could be an interesting place for such information.
The table below provides an overview, with following colour codes:
I'm not 100% sure -- all clarifications welcome! not in eXist function documentation
overview of eXist search functions and operators :
| | query type | query type | index use | index use | index use | index use | index use |
| function / operator | wildcards | regex | brute force fallback | range | legacy FT | lucene FT | ngram |
| fn:matches | | x | x | x | | | |
| fn:contains, fn:starts-with, fn:ends-with | | | x | x | | | |
| =, <, <=, >, >= | | | x | x | | | |
| text:match-any, text:match-all | | x | | | x | | |
| text:fuzzy-match-all, text:fuzzy-match-any | | | | | x | | |
| text:matches-regex | | x | x | x | | | |
| near, &=, |= | x | | | | x | | |
| ft:query | x | x | | | | x | |
| ngram:contains, ngram:starts-with, ngram:ends-with | | | | | | | x |
# XQuery/Publishing to Subversion
## Motivation

To have a single button on a content management system that will copy a file to a remote subversion repository.

## Method

Configuration of the subversion repository on a standard Apache server that is configured with an SSL certificate. This will encrypt all communication between the intranet system and the remote subversion server. We will also set the authentication to be Basic Authentication.

## HTTP Put Function for Basic Authentication

HTTP Basic authentication requires the user to concatenate the user and password with a colon separating the strings and then do a base64-encoding on that string. This is then sent in the HTTP header with the key of "Authorization". The HTTP header must look like the following:
The following XQuery function performs this process.
To put the file, put the URL in the correct content area, and the content to be inserted, the user name and password and

## Monitoring HTTP Client Libraries

Debugging authentication protocols is very difficult if you do not have the correct tools. A useful tool is to enable logging for the httpclient module.

## References

Wikipedia entry on Basic access authentication
# Motivation

Normal http query strings use the ampersand (&) character in order to differentiate between different terms in a query string. However, because ampersands also are used as the start of entities within HTML and XML, this can make it difficult encoding parametric content into XML links, and it moreover makes it difficult to visually decipher query strings.
This program illustrates how to parse query strings using alternative delimiters (such as the semi-colon).
This program demonstrates some standard XQuery functions that are not part of the original XQuery specification but are required for precise web server XQuery functionality.
The functions are:
* exist request:get-method
* exist util:unescape-uri
* exist request:get-query-string
* exist request:get-parameter
* exist request:get-parameter-names

## Platform

* eXist

## Parsing Query Strings
### common:get-parameters

This base function retrieves the query string from the URI, parses the string using the given delimiter and creates an XML structure of the form

### common:get-parameter

This function retrieves a sequence of string values corresponding to the values for a given parameter key given in the query string. Note that while typically there will be only one string in the sequence, if you have a query string of the form ?a=val1;b=val2;a=val3 then get-parameter("a","",";") will return ("val1","val3")

### common:get-parameter-names

This function retrieves the name of each query string key (once and only once per key).

## Example Program

Assumes query string of http://www.example.org/?a=5;b=test;a=8;c=new+message
returns
returns
returns
# XQuery/Project Euler

Project Euler is a collection of mathematical problems. Currently there are 166 so it may take some time to get through them all :-).

## Problem 1

Add all the natural numbers below 1000 that are multiples of 3 or 5.
Run

## Problem 2

Find the sum of all the even-valued terms in the Fibonacci sequence which do not exceed one million.
Run
This brute-force approach recursively builds the Fibonacci sequence (in reverse) up to the maximum, then filters and sums the result.

## Problem 3

What is the largest prime factor of the number 317584931803?
First we need to get a list of primes. The algorithm known as the Sieve of Eratosthenes is directly expressible in XQuery:
The list of primes starts off empty, the list of numbers starts off with the integers. Each recursive call of local:sieve takes the first of the remaining integers as a new prime and reduces the list of integers to those not divisible by the prime. When the list of integers is exhausted, the list of primes is returned.
Primes less than 1000
Factorization of a number N is also easily expressed as the subset of primes which divide N:
Hence
Factors of 666
And the largest is
Sadly this elegant method runs out of space and time for integers as large as that in the problem.

## Problem 4

Find the largest palindrome made from the product of two 3-digit numbers.
Run [ takes 20 seconds]

## Problem 5

What is the difference between the sum of the squares and the square of the sums for integers from 1 to 100?
Run
This nasty brute-force method can be replaced by an explicit expression using familiar formula:
Run
# Suomen kieli ulkomaalaisille/Eksistentiaalilause
## What is an Existential Clause?

An existential clause is one using the verb to declare the existence or place (or movement to or from a place) of some SUBJECT not previously spoken about. So it would be impossible to use a pronoun in an existential clause because pronouns require that we know what the noun is.

## Format of an Existential Clause

Existential clauses always begin with the declaration of place, followed by the verb (usually OLLA but not necessarily).
So typically the format is
* ADVERB VERB SUBJECT
* MISSÄ ON MIKÄ (or MITÄ)
       At some place IS something
Note: There is never an object in an existential statement.

## Learning examples

Pihalla on kaksi polkupyörää
    Literally On the yard there is two bikes
    Standard English There are a couple of bikes in the yard
Equally the existential sentence can be negative in meaning, in which case the verb is negative
Asunnossamme ei ole saunaa
    Literally In our apartment not is sauna
    Standard English There is no sauna in our apartment
And the verb does not have to be OLLA
Kouluun tulee pari vierailijaa
    Literally To the school comes two visitors
    Standard English There are two visitors coming the school

## Some Important Things to Note

Despite the similarity to English, there are several strong difference here.
1. The strong preference in English for SUBJECT to come before the VERB means that English puts the adverbial aspect at the end, whereas Finnish ALWAYS puts the adverbial place first when the sentence is introducing a new subject in an existential clause. So although Finnish is often more relaxed than English about word order, the existential clause word order is always ADVERB-VERB-SUBJECT.
2. English moves the verb according to the subject (IS or THERE ARE according to number). Finnish existential sentences the verb is ALWAYS IN THE THIRD PERSON SINGULAR even when there is more than one SUBJECT.
    Hence the use of the verbs form ON and TULEE not OVAT and TULEVAT in the examples above.
# Suomen kieli ulkomaalaisille/Sisältö/Elatiivi

In process of translation from Finnish to English
The Elative case is one of the locative cases in Finnish that indicates movement away from an internal situation.
The case ending of the elative is either -sta or -stä according to vowel harmony rules.
For example
kissasta from the cat kissa cat koirasta from the dog koira dog 'lehmästä from a cow lehmä cow keskuksesta from the centre keskus centre/town centre
The plural adds an -i- and the last vowel or consonant in the stem may change or disappear
kiss/o-ista from the cats koir/-ista from the dogs lehm/-istä from the cows keskuksista from the centre
Together with the inessive (or internal locative case) and the illative (or the internally directed locative case), the elative is one of the internal locative cases.
In its basic meaning the elative conveys a meaning which in English is rendered by the word from, or the words out of., meaning coming out of some place which has an internally locative case. So having been kaupassa' in a shop one will eventually tule kaupasta come out of the shop. Similarly we can say
koulusta out of school autosta out of the car 'sairaalasta out of hospital
Perusmerkitykseltään elatiivi on erosija, tarkoittaa konkreettisesti poistumista jonkin sisältä: talosta. Siitä on askel abstraktimpaan käyttöön: Havahduin mietteistäni. Suomessa usein jossakin kiinni olemista ilmaistaan sisäpaikallissijalla, joten on loogista, että otamme hatun päästä ja harjaamme pölyt vaatteistamme. Myös ulosmenoaukkoa ilmaistaan elatiivilla: Hyppäsimme ikkunasta. Puhe meni toisesta korvasta sisään, toisesta ulos. Kuten monilla muillakin sijamuodoilla, myös elatiivilla on muitakin merkityksiä kuin perusmerkityksensä. Esimerkkejä:
Alkuperä: Tein takin vanhasta mekostani. Itku pitkästä ilosta. Lehdet alkavat tyvestä. Hänestä tuli opettaja. Puuttuminen: Takista puuttuu nappi. Estäminen tai estyminen (liittyy useimmiten verbin infinitiiviin): Estin häntä lähtemästä. Varoitin häntä putoamasta. Syy, aihe: Miestä epäillään murhasta. Sydämeni pakahtuu surusta. Puhuminen, tietäminen, tunteminen: Hän puhui sinusta. Mistä sen tiedät? Iloitsen menestyksestäsi. Pidätkö vihreästä teestä? Kiinni pitäminen: Pidä minua kädestä. Ota kiinni kaiteesta. Mielipide: Minusta tuo on ruma. Omasta mielestäni onnistuin. Maksaminen: Myin vanhan autoni tuhannesta eurosta. Tässä satanen vaivoistasi. Aika: alkuviikosta, heti aamusta Muita: Hän on sekaisin päästään, tiukka arvostaan. Sovimme asiasta. Sali täyttyi ihmisistä. Housut repesivät takapuolesta.
# Suomen kieli ulkomaalaisille/Sisältö/Genitiivi prepositiot
## Genitive Prepositions

The locatative case endings -lla, -ssa, -lle, are used to describe absolute place. (e.g. se on pöydällä it's on the table. But sometimes we need to express location of one object relative to some other object. To do this we use of the many relative locatative words in the Finnish Language which are often used prepositionally, i.e. they come after the words that they relative to. In English , many of the equivalent words are prepositional, i.e. the come before the word that they are relative to. Postpositions are virtually non-existant in English, whereas in Finnish they are very common indeed. Most postpositions in Finnish govern the use of the genitive case.
Pallo on sohvan alla
    The ball is under the sofa
       Note the different sequencing of the words and the fact that sofa is in the genitive form sohvan.
These postpositional words may be expressed statically, but sometimes also with movement.
Often these words are associated with location (in front of, behind, below, above, etc.)
Sometimes they express...(to be continued)
# The Unicyclopedia/Resources

* The Unicyclopedia
* General
* Learning
* Unicycling Activities
* Resources
* Safety
* Organisations
* Skills
* Freestyle
* Street
* Trials
* Muni
* Rolling trials
* Racing
* Big wheels
* Giraffe
* Ultimate wheel
* BC wheel
* Double wheeler
* Equipment
* Hardware
* Maintenance
* Armour and clothing
* Manufacturers
* Buying a Unicycle

### Where do I find other unicyclists

Many unicyclists post on Rec.Sport.Unicycling. If you wish to converse with other unicyclists on non-unicycle related topics, Just Conversation is popular amongst unicyclists. Also look at the Unicycle Roster or the Unicyclist Googlemap. A few unicyclists currently use IRC on irc.freenode.net in #unicycling. You could also get in touch with your local or national Unicycle Organisation.

### Video footage of riders
#### Trials

* - Unitrials.de
* - Hell on Wheel
* Ottawa Unicycle Invasion 2004
* Jess Riegel
* Tony Melton - Unit 1.0

#### Street

* Mindless Films
* Xavier Collos

#### Freestyle

* Unicon 2004
* NAUCC 2004
* 2004 All Japan Unicycling Championships
* Leo Vandewoestijne

#### Misc

* unicyclist.org thousands of clips on skills.
* One Wheel - Muni and Street Videos
* Syko Production clip of the week
* Uni videos selected by Matayo Uptodate selection of the best videos available on the web

### Obstacle building and inspirations for it

* Detailed How-Tos for building different obstacles
* Gallery of obstacles KrisHolm rode in shows

### External resources

a few external resources

#### Personal Pages

* skyko productions
* Leo Vandewoestijne

#### Unicycle Stores & Manufacturers

* Unicycle.com
* Flames 'N Games Unicycle Store
* Semcycle
* Bedford Unicycles
* Coker 36" Wheel
* uniproshop

#### Forums and Communities

* The Unicyclist Community

#### Unicycle Hockey & Basketball

* Unicycle Hockey Homepage

#### Tips

* unicyclist.org
* unicycletips.com

#### Other Languages

other languages besides English
* Swiss unicycle federation
* The French Federation of Unicycling
* Lithuanian Uni
* Russian unicycles
* Monociclos en español
# The Unicyclopedia/Rolling trials

* The Unicyclopedia
* General
* Learning
* Unicycling Activities
* Resources
* Safety
* Organisations
* Skills
* Freestyle
* Street
* Trials
* Muni
* Rolling trials
* Racing
* Big wheels
* Giraffe
* Ultimate wheel
* BC wheel
* Double wheeler
* Equipment
* Hardware
* Maintenance
* Armour and clothing
* Manufacturers
* Buying a Unicycle
Rolling trials (or RT) is a yet another more recent form of unicycling. It works like normal trials in many ways, the unicyclist tries to navigate a course without stepping off the unicycle or touching the ground. The main difference between rolling trials and normal trials is that in rolling trials, you cannot hop. You are only allowed to roll along the course. This presents a new type of challange and also allows people who are not interested in learning how to hop with a chance to do trials, although hopping is, for most people, easier to learn than riding itself. It does, however, take a certain type of skill. See example courses for examples.

## Example courses

Ray's MTB
# The Unicyclopedia/Racing

* The Unicyclopedia
* General
* Learning
* Unicycling Activities
* Resources
* Safety
* Organisations
* Skills
* Freestyle
* Street
* Trials
* Muni
* Rolling trials
* Racing
* Big wheels
* Giraffe
* Ultimate wheel
* BC wheel
* Double wheeler
* Equipment
* Hardware
* Maintenance
* Armour and clothing
* Manufacturers
* Buying a Unicycle
Unicycle racing consists of track racing, road racing, and off-road racing.
Track racing is done on a level closed-course circuit, and is governed by IUF Rules, as well as applicable rules of national and local governing bodies. The traditional racing class is for 24" wheels with cranks no shorter than 5", but 700c wheels and larger are allowed in some track events. Records are kept by the IUF and Guinness World Records(TM). Races include sprints, medium distances up to 1600m, and open time records (e.g. 1, 12 and 24 hour records). There are backwards as well as forward races, slow as well as fast, and even obstacle courses.
Road racing is generally limited to the 10K (6.2 miles) for official races, but longer races are also becoming popular. Road racing can be done on any open course, either out & back, or point A to point B. Road racing can and often does include hill climbs. There are no wheel size limits.
Off-road racing on MUnis is very popular, and many unicyclists have participated in mountain bike races of all distances and degrees of difficulty. MUni racing can consist solely of a hill climb, to cross-country style, to downhill. Equipment is generally unlimited, and usually includes wide knobby tires and well-padded saddles.
# The Unicyclopedia/Safety

* The Unicyclopedia
* General
* Learning
* Unicycling Activities
* Resources
* Safety
* Organisations
* Skills
* Freestyle
* Street
* Trials
* Muni
* Rolling trials
* Racing
* Big wheels
* Giraffe
* Ultimate wheel
* BC wheel
* Double wheeler
* Equipment
* Hardware
* Maintenance
* Armour and clothing
* Manufacturers
* Buying a Unicycle
Unicycling is a relatively safe sport but at the same time it can be as dangerous as you want it to be. If you want to learn the basics, and if you have some prior experience with exercise, it's very unlikely that you will sustain any serious injuries.
A gym floor is probably the safest place to start practicing. In case you lose balance getting off a unicycle is easy, you just put a foot down on the ground.
Unicycle safety is a bit different from bicycle safety. People who are new to unicycling tend to use their hands as to cushion most of their falls, but this is not the ideal method to land as it's easy to sprain or even break your wrist using this method. If you don't know what you are doing, use wrist guards or at least gloves. Falling backwards is also a risk, so a helmet is recommended.
Most beginner cycles have plastic pedals that will only cause slight pain and maybe some brushing when the inevitable happens and it smacks you in the shin, however if you have metal pedals, and in particular if you have pedals with bear claws, use leg armour. A slip from a bear claw pedal has a large possibility of tearing the skin and may require stitches. In general a bit of armour can be the difference between a painful bruise and another half hour of practice. More information about armour can be found in the Armour and Clothing section.
Remember to tie your shoelaces up or tuck them away so that they don't get caught in the cranks. If you notice your laces are caught in the cranks, and you get off quickly you should be okay, but you shouldn't rely on noticing it in time.
If your shoes come untied often, check out "Ian's Secure Shoelace Knot" for security. If your laces are too long, and the ends get caught, use one of the knots advertised as "shortens laces." See those knots and more on Ian's Shoelace Site