OpenLLM-France/wikimedia huggingface dataset:
# XQuery/Getting URL Parameters
## Motivation

You want to create an XQuery that takes a parameter from the calling URL.

## Format

The format of a calling URL that uses the HTTP Get or POST command is:
Where param1 is the first parameter with a value of 123 and param2 is the second parameter with a value of 456.
Note that question mark is used to start the parameters and the ampersand is used to separate parameters. Remember to include "amp;" following the &.

## Checking Data Types

Additionally you can check the data types using the XML Schema data types and the castable as operator.

## Script to echo all URL parameters

echo-parameters.xq
Here are the results of sending the parameters "a=1&b=2" to this XQuery:

## Adding a Debug Parameter

It is very common that you want to conditionally turn on part of a transform to get additional information during the debugging process.
# XQuery/Converting HTML tables to XSL-FO tables
## Motivation

You have a collection of HTML tables that you want to convert to PDF.

## Method

We will use an XQuery typeswitch transformation that will convert the key table elements (table,thead,tr,th,db,tbody) to the corresponding XSL-FO elements.

## Sample Main Dispatcher

We will create an XQuery module with the following functions:
* a main dispater function for starting the transform
* a single function for each table element
* a function to process the class attributes for each element
To transform the table the following will be used:
The main function of the
# XQuery/Creating XQuery Functions
## Motivation

You want to avoid duplication of XQuery code or create more modular XQuery programs.

## Method

Use XQuery functions to encapsulate any chunk of XQuery code with a function wrapper.
Any time you see a grouping of XQuery or XML code in your XQuery program that you would like to standardize, it is good design to start creating your own XQuery functions.

## Static Content

Static content is content that is fixed and is not changed by the use of parameters. XQuery functions are ideal for storage of static content libraries.
For example, if all your HTML pages have the same block of code that has your logo and header text, you can create a simple XQuery function that encodes this functionality. Here is the HTML code you want to standardize on:
When you want to reference this you just call the function by placing it in your HTML page and enclosing it in curly braces:
Note that these functions names are preceded by "local:". This is the default namespace of a function invoked only in the same XQuery main module.
If you want to store your functions in a separate file, you can do so. Such a file is called a "library module". To make use of the functions in this module, you need to "import" the module in the prolog of your query. The benefit of storing your code in functions and modules is that if you ever need to make a change to a function, you only have to make the change in one location, rather than in the many locations where you've copied and pasted the same code.
The following file, which we will save as webpage.xqm, is an example of this (note also the addition of a footer function):
The module begins with a declaration of the module's namespace. Here we use an arbitrary namespace, "webpage".

### Static Page Assembly

To use this function module you must import the module at the top of your XQuery file (the following "import module" expression assumes your XQuery file is in the same directory as the module file, webpage.xqm):

## Dynamic Content

Unlike static content, dynamic content can be modified by including parameters into the function. One very common approach is to use a "page-assembler" function that includes parameters such as the document title and content. Here is an example of this function.

### Dynamic Page Assembler Function

Your web pages now can all reference a central page assembler like the following.
# XQuery/Creating a Timeline
## Motivation

You want to create a timeline of event data. Timelines show events in a horizontal scrolling view.

## Method

We will use the JavaScript client Timeline widgets provided by the Simile-Widgets project. In this example we will be using the timeline 2.2.0 API calls.
To do this we need to transform a list of event dates into the proper formats and then create an HTML page that includes calls to the Simile JavaScript libraries.
Steps
* View sample Event XML File format
* View HTML template that loads XML file
* Create XQuery Function that generates the HTML template and loads the appropriate XML data file
Our first example will use a list of non-Duration Events (Instant Events). We will explore duration events and other events in a future chapter.
We will then create a simple XQuery module with a single function that loads a simple timeline.

## Sample XML File Using Standard XML Date Formats

Most XML dates use ISO 8601 coding. To use this format you must put in a date format attribute in the data file.
Note that the data file must specify the ISO8601 date formats that are used as the XML date format.

## HTML Driver Template

The sample HTML file shows how this XML file is loaded using the Timeline.loadXML function.

## Sample Image

This will produce the following example:
# XQuery/DBpedia with SPARQL - Stadium locations

At the risk of being repetitious, here is another script which mashes up data from DBpedia with GoogleMaps, this time to show the location of all venues in a supplied Wikipedia Category of venues.

## Examples
### Football Venues in England

* kml
* GoogleMap

### Football Venues in Scotland

* kml
* GoogleMap
# XQuery/Dataflow diagrams

This description of the data flow in the Timetable application (another page scraping application) is loosely based on XPL
With a map from types to shapes:
Conversion to dot format for onward conversion to a GIF image
Dot file Diagram
# XQuery/DOJO data
## Motivation

You want to use XQuery with your DOJO JavaScript library which uses a variation of JSON syntax.

## Method

DOJO is a framework for developing rich client side applets in javascript: from the nice to have to the core webapp. Some day you may want to deliver your data in a way, that you or other people can easily use from DOJO.
DOJO specifies its own idiosyncratic way of wrapping data in JSON formatted objects, so it can be consumed by lots of its widgets: trees, grids, comboboxes, input fields etc. Below example (note the use of single quotes, which makes this invalid JSON) is taken from its web supplied documentation:
Now, if eg. you want to feed an incremental user input widget from a server side search, xquery (in eXist at least) makes this a piece of cake. Please read below script as an introduction to the concept, very likely it can be optimized. The search itself uses a lucene fulltext index, which returns very quickly.
The xquery extension json:xml-to-json($node as node) does all the magic. In the result variable the data structure is created in the way DOJO wants it (per default), as shown above. Another thing to note: DOJO expects the identifier to be unique. It is up to you to design your data to satisfy this. Another note: as of today (eXist trunk of early september 2010) numbers in the output are quoted, it is up to you to convert them on the client for optimal processing.
# XQuery/Convert XML to JSON

You can use the JSON output method to convert XML to JSON format. (For an important note on this article, see https://stackoverflow.com/questions/48876292/how-to-use-the-xslt-xquery-serialization-namespace-to-export-to-json/.)
# XQuery/DBpedia with SPARQL and Simile Timeline - Album Chronology

In this example, the SIMILE project's Timeline JavaScript is used to display the chronology of the albums released by a selected artist or group. As with the football teams in the previous example, the data is extracted from DBpedia via a SPARQL query.
This example has three components:
* an XQuery script which creates the HTML page, linking to the Timeline JavaScript
* an XQuery script to query DBpedia for albums for a selected group, assign a year of release to each album and generate a set of events in the form expected by the TimeLine script.
* an XQuery script to provide an index of groups in a given category

## HTML Page script

The script accepts one parameter, the name of the artist or group. The JavaScript required to customize the Timeline is defined in-line in a CDATA section. The onLoad function accepts two parameters, the name of the artist and a date to provide the initial focus for the timeline. The event stream is provided by the call to the XQuery script group2tl.xq, passing the group name.
The JavaScript interface here is minimal.

## TimeLine events group2tl.xq

This script has a similar structure to the football team script. A prototype SPARQL query is edited to change the default name to the supplied name, the query sent to the DBpedia SPARQL service and the resultant SPARQL XML result converted to XML tuples.
Note - the group name needs an additional encoding because SPARQL requires URIs to be uri encoded and group names may contain characters such as ( and ) which require encoding. Hence Queen_(band) must appear in the URI in SPARQL as Queen_%28band%29. In addition the whole query is uri encoded which allows this encoding to be recovered when the whole query is decoded by the SPARQL service. (Whew!)
As with the Football clubs, there may be multiple tuples for the same album and the best (at present just the first non null) set of data needs to be extracted from these tuples. The year of release is hacked out of the multitude of different date formats which may appear and each album represented in the format expected by Timeline, with the pop-up contents serialised. This is limited to the album cover if available and links to DBpedia and Wikipedia.

## Execution

* Pink Floyd
* Leonard Cohen

## Group Index

This script queries DBpedia for the resources which belong to a specified category, for example Rock_and_Roll_Hall_of_Fame_inductees. A table of group names in alphabetical order provides links to the Timeline view using the script above, and to an HTML table view of the discography.
Index of Rock and Roll Groups and Artists
# Algebra/Chapter 20

Chapter 20: Complex Numbers
← Chapter 19 · Chapter 21 →

## Sections

* Arithmetic with Complex Numbers
* Powers of Complex Numbers
* Complex Number Algebra
* More about the Quadratic Formula
* More about Polynomials

## Extra

* Review
* Practice Problems
* Solutions to Practice Problems
* Glossary
# 99 Elm Problems/Problem 96

In a the Ada programming language identifiers are defined by the syntax diagram below.
# # # THIS IS A STUB # # #
Result:
Solutions
# 99 Elm Problems/Problem 99/Solutions

Descript of first solution
# 99 Elm Problems/Simple List functions

Let’s practice using basic functions from the List module.
Problem 6 - Use List.reverse to test if a list is a palindrome.
Problem 17 - Use List.take and List.drop to split a list into two lists.
Problem 18 - Use List.take and List.drop to take a portion of a list
Problem 20 - Use List.take and List.drop and the append operator (++) or List.append to remove an element from a list.
Problem 19 - Use List.take and List.drop and the append operator (++) or List.append to rotate the elements of a list.
Problem 21 Use List.take, List.drop, append operator (++) and the “cons” operator (::) to get a specified element from a list. You may want to use split from Problem 17.
# 99 Elm Problems/Problem 99

See more text and diagrams
# # # THIS IS A STUB # # #
Result:
Solutions
# 99 Elm Problems/Problem 97

See more text and diagrams
# # # THIS IS A STUB # # #
Result:
Solutions
# 99 Elm Problems/Problem 98

See more text and diagrams
# # # THIS IS A STUB # # #
Result:
Solutions
# Adventist Youth Honors Answer Book/Stars/Zodiac

By 2,000 BC, the Egyptians and Mesopatamians marked the seasons by the constellations we now call Taurus, Leo, Scorpio and Aquarius. The division of the ecliptic into the zodiacal signs originates in Babylonian ("Chaldean") astronomy in the early to mid 1st millennium BC (likely during Median/"Neo-Babylonian" times).
The signs were named after the nearby constellations at the time of Ptolemy, most of which were named after animals, hence the term zodiac (from Greek zodiakos, "circle of little animals").
* ♈ Aries 0° (vernal equinox)
* ♉ Taurus 30°
* ♊ Gemini 60°
* ♋ Cancer 90° (summer solstice)
* ♌ Leo 120°
* ♍ Virgo 150°
* ♎ Libra 180° (autumnal equinox)
* ♏ Scorpius 210°
* ♐ Sagittarius 240°
* ♑ Capricornus 270° (winter solstice)
* ♒ Aquarius 300°
* ♓ Pisces 330°
# Adventist Youth Honors Answer Book/Swamp leadership skills
## Saltwater Swamps

Saltwater swamps are common in coastal areas subject to tidal flooding. Mangrove trees thrive in these swamps. Mangrove trees can reach heights of 12 meters, and their tangled roots are an obstacle to movement. Visibility in this type of swamp is poor, and movement is extremely difficult. Sometimes, streams that you can raft form channels, but you usually must travel on foot through this swamp.
You find saltwater swamps in West Africa, Madagascar, Malaysia, the Pacific islands, Central and South America, and at the mouth of the Ganges River in India. The swamps at the mouths of the Orinoco and Amazon rivers and rivers of Guyana consist of mud and trees that offer little shade. Tides in saltwater swamps can vary as much as 12 meters.
Everything in a saltwater swamp may appear hostile to you, from leeches and insects to crocodiles and caimans. Avoid the dangerous animals in this swamp.
Avoid this swamp altogether if you can. If there are water channels through it, you may be able to use a raft to escape.

## Freshwater Swamps

You find freshwater swamps in low-lying inland areas. Their characteristics are masses of thorny undergrowth, reeds, grasses, and occasional short palms that reduce visibility and make travel difficult. There are often islands that dot these swamps, allowing you to get out of the water. Wildlife is abundant in these swamps.

## Swamp Bed

In a marsh or swamp, or any area with standing water or continually wet ground, the swamp bed keeps you out of the water. When selecting such a site, consider the weather, wind, tides, and available materials.
To make a swamp bed--
* Look for four trees clustered in a rectangle, or cut four poles (bamboo is ideal) and drive them firmly into the ground so they form a rectangle. They should be far enough apart and strong enough to support your height and weight, to include equipment.
* Cut two poles that span the width of the rectangle. They, too, must be strong enough to support your weight.
* Secure these two poles to the trees (or poles). Be sure they are high enough above the ground or water to allow for tides and high water.
* Cut additional poles that span the rectangle's length. Lay them across the two side poles, and secure them.
* Cover the top of the bed frame with broad leaves or grass to form a soft sleeping surface.
* Build a fire pad by laying clay, silt, or mud on one comer of the swamp bed and allow it to dry.
Another shelter designed to get you above and out of the water or wet ground uses the same rectangular configuration as the swamp bed. You very simply lay sticks and branches lengthwise on the inside of the trees (or poles) until there is enough material to raise the sleeping surface above the water level.
# Adventist Youth Honors Answer Book/Swimming/Swimming Safety

* Never swim alone. Always swim with a buddy.
* Do not swim unless there are adults present.
* Do not dive into water until you know that it is deep enough and free from debris
* On beaches, rivers, and lakes, wear protective footwear. This will guard against broken glass, sharp rocks, etc.
* Never pretend to be drowning
* If swimming in an area monitored by a life guard, stay in the life guard's view.
* Do not chew gum or eat food while swimming.
* Stay clear of diving boards. A diver may not see you.
* Do not engage in horseplay, jump on, or dunk another swimmer.
* Do not run in a pool area.
* Pool areas should be fenced in to keep toddlers out. Keep the gate closed!
* Obey the rules established for the swimming area.
* Only swim in areas where swimming is allowed.
* If caught in a riptide, swim parallel to shore. Riptides are narrow, so you should be able to swim out of the current by swimming across it.
* Do not swim out farther than you can swim out. Remember that you are more tired when you get out there than when you started, so be conservative. Do not overestimate your abilities.
* Do not swim during stormy weather.
* Do not rely on inflatable toys as life preservers. If you try to cross a large body of water on an air mattress and it springs a leak, you could be in serious trouble. Never go farther out on one of these than you can swim back.
    References:
   * girlpower.gov
   * kidshealth.org
# Adventist Youth Honors Answer Book/Stuffing Recipe
## Ingredients

* 1 small onion
* 1 stalk of celery
* 1 clove garlic
* 2 Tablespoons butter or margarine
* 1/2 teaspoon sage
* 1/2 teaspoon thyme
* 1 cup vegetable broth
* 4 cups bread crumbs

## Procedure

Finely chop the onion, celery, and garlic, then sauté them in the margarine in a 2 quart pot until transparent. Add the sage and thyme and vegetable broth and simmer for 5 minutes. Remove from heat and add the bread crumbs, folding them into the mixture. Let it sit for 10 minutes, fluff, and serve.
# Adventist Youth Honors Answer Book/Stars/Southern Cross, Orion and Scorpio
## Southern Hemisphere

The Southern Cross, Scorpio, and Orion are not really located very close to one another. It would be possible to draw them all on a single diagram, but since Orion is on the other side of the sky from the other two, you'd end up drawing an awful lot of sky. Therefore, it should be acceptable to draw these three on independent diagrams.
# Adventist Youth Honors Answer Book/Stars/Sunspot

A sunspot is a region on the Sun's surface that is marked by a lower temperature than its surroundings and intense magnetic activity, forming areas of low surface temperature. Although they are blindingly bright, at temperatures of roughly 4000-4500° K, the contrast with the surrounding material at some 5700° K leaves them clearly visible as dark spots. If they were isolated from the surrounding photosphere they would be brighter than an electric arc.
# Adventist Youth Honors Answer Book/Stars/Terms
## a. Celestial sphere

    The celestial sphere is an imaginary rotating sphere of "gigantic radius", with the Earth at its center. All objects in the sky can be thought of as lying upon the sphere.

## b. Celestial pole

    The two celestial poles are the imaginary points where the Earth's spin axis intersects the celestial sphere. The north celestial pole currently has nearly the same coordinates as the bright star Polaris (which is Latin for "Pole Star").

## c. Celestial equator

    The celestial equator is a great circle on the imaginary celestial sphere, which is actually the plane of the terrestrial equator extended out into the universe (i.e., it could be constructed by extrapolating the Earth's equator until it touches the celestial sphere).

## d. Horizon

    The horizon is the line that separates earth from sky.

## e. Right ascension

    Right Ascension is the astronomical term for one of the two coordinates of a point on the celestial sphere when using the equatorial coordinate system. It is equivalent to terrestrial longitude.

## f. Declination

    Declination is one of the two coordinates of the equatorial coordinate system, the other being either right ascension or hour angle. Dec is comparable to latitude, projected unto the celestial sphere, and is measured in degrees north and south of the celestial equator. Therefore, points north of the celestial equator have positive declination, while those to the south have negative declination.

## g. Transit

    A transit is the astronomical event that occurs when one celestial body appears to move across the face of another celestial body, as seen by an observer at some particular vantage point.

## h. Conjunction

    Conjunction means that, as seen from some place (usually the Earth), two celestial bodies appear near one another in the sky.

## i. Ecliptic

    The Ecliptic is the apparent path of the Sun traced out along the sky in the course of the year. More accurately, it is the intersection of the celestial sphere with the ecliptic plane, which is the geometric plane containing the mean orbit of the Earth around the Sun.
# Adventist Youth Honors Answer Book/Stars/Prism

When sunlight is passed through a prism, it is dispersed into the colors of the rainbow. In fact, when you see a rainbow after a rain storm, it too is made by sunlight passing through many tiny prisms - the raindrops.
Careful study of these rainbows reveals that there are gaps between some of the colors. These gaps are called absorption lines, and depending on where they are in the spectrum (that is, where they are in the rainbow), scientists can tell what the light source is made of. Scientists also discovered that the temperature of a star is determined by its composition. So by observing the spectrum, scientists can tell the temperature of a star.
# Adventist Youth Honors Answer Book/Stars/Satellite

A satellite is an object that orbits a planet. There are two basic types of satellites: natural, and artificial. Our Moon is a natural satellite, and all the planets beyond Earth's orbit have them as well (we keep discovering more and more of them, so it's hard to put a number on it). The other type of satellite is an artificial satellite, and these are most often used for communications (think satellite TV dishes).
# Adventist Youth Honors Answer Book/Stars/Telescope

A refractor telescope is a type of optical telescope that refracts or bends light at each end using lenses.
A reflector telescope is a telescope which uses a combination of curved and flat mirrors to reflect light and form an image, rather than lenses to refract or bend light to form an image.
An equatorial mount is a mount used for moving a telescope or camera along two perpendicular axes of motion (right ascension and declination). The telescope mount's axis of right ascension should be pointed directly towards whichever celestial pole is above the horizon to work correctly.
# 99 Elm Problems/Problem 14/Solutions

Solution 1: Recursive version
Solution 2: Pointfree, using List.foldr
# 99 Elm Problems/Problem 14

Duplicate each element of a list.
Result:
Solutions
# 99 Elm Problems/Problem 15/Solutions

Solution 1: Using List.foldr
# 99 Elm Problems/Problem 12

Decompress the run­-length encoded list generated in Problem 11.
Result:
Solutions
# 99 Elm Problems/Problem 12/Solutions

Solution 1: Recursive version
# 99 Elm Problems/Problem 15

Repeat each element of a list a given number of times.
Result:
Solutions
# 99 Elm Problems/Problem 16

Drop every N'th element from a list.
Result:
Solutions
# 99 Elm Problems/Problem 16/Solutions

Solution 1: Using List.foldr and List.indexedMap
# 99 Elm Problems/Problem 17

Split a list into two parts; the length of the first part is given.
Result:
Solutions
# 99 Elm Problems/Problem 11/Solutions

Solution 1: Recursive version