OpenLLM-France/wikimedia huggingface dataset:
# SPARQL/Modifiers

There are 4 optional modifiers to the SELECT ... WHERE { .. }. See the chapter on SELECT for an introduction.
The five modifiers are GROUP BY ..., HAVING ..., ORDER BY ..., LIMIT ... and OFFSET ....

### GROUP BY

Let us consider this list of children of Bach, listing also their mother
Try it!
Let us group this list by the mothers.
Try it!
We GROUP BY both variables ?mother and ?motherLabel because if we would leave out the label we would end up with an error "Bad Aggregate".
First we added (COUNT(?child) AS ?children) to count the number of children. COUNT is one of the Aggregate functions MIN, MAX, SUM, AVG, COUNT or SAMPLE. Notice first that it counts the variable ?child. Notice as well that the syntax is (COUNT(?var1) AS ?var2).
As second information we added a combined list of children per mother by using (GROUP_CONCAT(DISTINCT ?var1; SEPARATOR=", ") AS ?var2).
When using GROUP_CONCAT and a label, all labels should be defined explicitly in the SERVICE.

### HAVING

HAVING is always used in combination with GROUP BY
Try it!
HAVING will filter out groups that does not meet the condition specified. In this case only one mother is shown, with 13 children.
As COUNT(?child) is bound to the variable ?children the HAVING clause can also be written as HAVING (?children>7).
The HAVING clause can be useful for finding duplicates for instance like HAVING (COUNT(?var)>1).

### ORDER BY

ORDER BY something sorts the results by something. something can be any expression or variables. This expression can also be wrapped in either ASC or DESC to specify the sorting order (ascending or descending). (If you don’t specify either, the default is ascending sort, so ASC(something) is equivalent to just something.)
Try it!

### LIMIT

LIMIT count cuts off the result list at count results, where count is any natural number. For example, LIMIT 10 limits the query to ten results. LIMIT 1 only returns a single result.
This could be useful to get the top 10 results, or only 10 random results to see how the data looks like.

### OFFSET

OFFSET count can be used to skip the first number of results. OFFSET 100 LIMIT 10 returns records 101-110.

### References

* d:User:TweetsFactsAndQueries/A Guide To WDQS
# SPARQL/Prefixes

WDQS understands many shortcut abbreviations, known as prefixes. Some are internal to Wikidata wd, wdt, p, ps, bd, etc. and many others are commonly used external prefixes, like rdf, skos, owl, schema, etc.
In the following query, we are asking for items where there is a statement of "P279 = Q7725634" or in fuller terms, selecting subjects that have a predicate of "subclass of" with an object of = "literary work".
For simple WDQS triples, items should be prefixed with wd:, and properties with wdt:. This only applies to fixed values – variables don’t get a prefix.
Try it!
Without the use of prefixes this should be written as
Try it!
Actually all mentioned prefixes are built in in the Wikidata Query Service, so they can be left out
Try it!
The full list of built in prefixes is

### References

* mw:Wikibase/Indexing/RDF_Dump_Format#Prefixes_used - details about each prefix
* Wikidata query service/User Manual
# SPARQL/FILTER

FILTER(condition) is a clause you can insert into your SPARQL query to, well, filter the results. Inside the parentheses, you can put any expression of boolean type, and only those results where the expression returns true are used.

### FILTER on values

For example, to get a list of all humans born in 2015, we first get all humans with their date of birth –
– and then filter that to only return the results where the year of the date of birth is 2015. There are two ways to do that: extract the year of the date with the YEAR function, and test that it’s 2015 –
– or check that the date is between Jan. 1st (inclusive), 2015 and Jan. 1st, 2016 (exclusive):
I’d say that the first one is more straightforward, but it turns out the second one is much faster, so let’s use that:
Try it!

### FILTER on values in Labels

Another possible use of FILTER is related to labels. The label service is very useful if you just want to display the label of a variable. But if you want to do stuff with the label – for example: check if it starts with “Mr. ” – you’ll find that it doesn’t work:
Try it!
This query finds all instances of Q15632617 and tests if their label starts with "Mr. " (STRSTARTS is short for “string starts [with]”; there’s also STRENDS and CONTAINS). The reason why this doesn’t work is that the label service adds its variables very late during query evaluation; at the point where we try to filter on ?humanLabel, the label service hasn’t created that variable yet.
Fortunately, the label service isn’t the only way to get an item’s label. Labels are also stored as regular triples, using the predicate rdfs:label. Of course, this means all labels, not just English ones; if we only want English labels, we’ll have to filter on the language of the label:
The LANG function returns the language of a monolingual string, and here we only select those labels that are in English. The full query is:
Try it!
We get the label with the ?human rdfs:label ?label triple, restrict it to English labels, and then check if it starts with “Mr. ”.

### FILTER NOT EXISTS

Let's add images to these fictional humans
Try it!
The code OPTIONAL{ ?human wdt:P18 ?image. } shows all the fictional humans that start with “Mr. ” and shows an image if available. To select only fictional humans starting with “Mr. ” with an image the code ?human wdt:P18 ?image. can be used. To select those fictional humans without an image the code FILTER NOT EXISTS{ ?human wdt:P18 ?image. } should be used
Try it!

### MINUS

A similar way of negation provided in SPARQL is MINUS which evaluates both its arguments, then calculates solutions in the left-hand side that are not compatible with the solutions on the right-hand side.
Try it!

### References

* d:User:TweetsFactsAndQueries/A Guide To WDQS
* W3C SPARQL 1.1 Query Language specifications
# SPARQL/FAQ

The most popular questions-and-answers can be obtained through external links:
* Most popular SparQL questions
* Most popular Wikidata questions
# Salute, Jonathan!/Grammar (accent)
## Accent (word stress)

The main rule to remember is that primary stress is on the vowel before the last consonant.
| Word | Last consonant | Stress |
| pensa | s | pénsa |
| pensar | r | pensár |
| ama | m | áma |
| amar | r | amár |
| amore | r | amóre |
The syllables bil, ic, im, and ul take the accent on the preceding syllable. In addition, the plural -s and the two syllables men and um at the end of words do not change the stress of the preceding part of the word.
| Word | Meaning | Stress |
| regul | rule | régul |
| maximum | maximum | máximum |
| amabil | lovely | amábil |
| narcotic | narcotic | narcótic |
| persones | people | persónes |
| rapidmen | rapidly | rapídmen |
Certain endings like -tá and -ería have a written accent, in which case this becomes the accent for the word. And some words have an accent of their own due to reasons such as internationality.
| Word | Normal stress | With ending | Stress without accent would have been... |
| amabil | amábil | amabilitá | amabilíta |
| vitre | vítre | vitrería | vitréria |
| café | | | cáfe |
# Prolog/Inference Engines

This article needs attention from experts!
By default Prolog does a top-down logic inference.
Example:
We run this as "hasgirlfriend(X)." to get the people who have a girlfriend.
Bi-directional inference:
We run this as "run.".
We don't have to directly ask who has a girlfriend, it gives us all results that can be implied. The benefit of bidirectional inferencing is the speed gain.
# Prolog/Input and Output
## Filename convention

Filenames must be put between apostrophes, so they become atoms. ( "foo.txt" will not work, because it's a list of characters and not an atom.) In Windows systems you can write paths as 'C:/foo.txt' or 'C:\\foo.txt'.

## Reading a file the Edinburgh style

You can open a file with see/1 and close with seen/0. The following program reads a file, and prints it to the standard output:
You can have multiple files open at the same time: If you use see(file1) and then see(file2), you will have 2 open files at the same time, and if you now call get_char, it will read from file2. If you call see(file1) again, file1 will be active again. You can close these files in any order you want.
The read predicate is for parsing prolog terms. (It can handle DCG grammars as well.) You might need it for self-modifying programs, or for programs which transforms prolog code.

## Reading a file the ISO style

When following the ISO standard, data from files and from network are handled the same way: as data streams.
* Open a file for reading: open(Filename, read, Streamhandler)
* Open a file for writing: open(Filename, write, Streamhandler)
# Prolog/Higher Order Programming
## Introduction

Higher-order programming means writing programs that take other programs as input and/or return still other programs as output. Higher-order programming is common in functional programming, but can be in done in Prolog as well.
As an example, suppose you are writing a speech synthesis application that reads out phone numbers aloud. We might have a predicate digit_english/2 that relates Prolog integers 0 through 9 to English words (as symbols):
Now, to translate a phone number, define:
Now, suppose we want to add support for another language, say, German. You define digit_german:
To translate a phone number, use phone_german:
Note the common recursion pattern in phone_english/2 and phone_german. You've probably seen that many times before, even written it several times. It can be summed up as:
* Base case: relate the empty list to itself.
* Recursive case: relate the first element of the first list to the first element of the second via some predicate, then recur on the tails of both lists.
This pattern can be captured by a higher-order predicate generally known as map/3 (but not defined by standard Prolog):
In Prolog, we cannot write P(X,Y) since the head of a functor must be a symbol. Therefore, we use the infix operator =.. that unifies its first argument with a term built from its right argument, which must be a list. The first element, which must be a symbol, becomes the functor, the rest its arguments. We then apply call/1 to the term we constructed to invoke it as a Prolog goal. Note that many Prolog implementations also define call/2, call/3, ... built-in predicates which construct a callable term out of the given arguments (with the first argument being the principal functor), so that the above code example can be also written as
We can now redefine phone_english/2 and phone_german/2 as:
Both predicates still work in both directions and non-determinism is preserved.
The benefit is obvious: by using map/3, we avoid repeating code fragments so our programs become shorter and easier to read and understand.

## See also

The following research paper is about higher order programming in prolog and contains numerous examples:
# Prolog/Glossary

This is a glossary of common Prolog terms.

## Argument

    Arguments are terms that appear in a compound term. E.g. A1 and a2 are the first and the second argument of the term myterm(A1, a2).

## Arity

    The number of arguments that a predicate takes. E.g. member(X,List) has arity 2. In documentation, the arity of a predicate is written as predicate/arity. E.g. member/2.

## Backtracking

    If a sub-goal fails, the built-in Prolog search mechanism will go back to the parent-goal. Any variables that were instantiated in the sub-goal will be un-instantiated. Prolog will then search for a new way of satisfying the sub-goal. This process is called backtracking.

## Clause

    A single clause of a relation, usually defined as Head :- Body, but see also fact.

## Compound term

Also called structure. It consists of a name followed by N arguments, each of which are terms. N is called the arity of the term.

## Fact

    A clause with no body, that is a head on its own.

## Functor

    Combination of name and arity of a compound term. The term foo(a, b, c) is said to be a term belonging to the functor foo/3 . foo/0 is used to refer to the atom foo.

## Goal

    Question stated to the Prolog engine. A goal is either an atom or a compound term. A goal succeeds, in which case the variables in the compound terms have a binding or fails if Prolog fails to prove the goal.

## Ground Term

    A Term which has no logic variables in it.

## Predicate

    A set of clauses or a relation.

## Query

    See goal.

## Relation

    Synonym for Predicate.

## Recursion/Recursive

    Definition missing

## Rule

    See clause.

## Term

    Every object in Prolog is a term, that includes variables, compounds, numbers, source code.

## Unification

    Prolog process to make two terms equal by assigning variables in one term to values at the corresponding location of the other term. E.g.,
?- foo(a, B) = foo(A, b). A = a, B = b. Unlike assignment, which does not exist in Prolog, unification is not directed.

## Singleton Variable

    If a variable is named only once in a clause, usually it is replace with _.

## Footnotes

* ↑ https://www.swi-prolog.org/pldoc/man?section=glossary
# Prolog/Graphics: XPCE

XPCE is the so-called Prolog graphic library , although it isn't Prolog at all. Like they mention in it's manual, XPCE is not Prolog; XPCE is an object-oriented language that has absolutely nothing to do with Prolog.
The first thing that we need to do to create applications in XPCE is to install Swi-Prolog. You can find it at it's distributor page.
The page about XPCE is http://www.swi-prolog.org/packages/xpce/.
to be continued...
# Prolog/Introduction/Answers
## x

We'll use the following database, to represent a section of this family tree.
1. List the women in the database
2. List the children in the database
3. List all combinations of a father and his son.
4. which women have both a father and a son in the database?
5. (Extra question) Can you think of a way to display those women that do not have a father listed in the database? Can you describe what you would need to write such a query??
You need to use negation.
Rules to put inside db:
Query:
# Public Meeting Notices and Agendas/Guidelines

Public Meeting Notices and Agendas is intended to help local and larger jurisdictions and other interested parties the understanding and best practices for creating a healthy ecology of public notices within a larger civic ecology. Towards this we have a few guidelines:
* Jurisdictions should not have to cede identity, jurisdiction or oversight over their public notice systems as part of any contract or terms of service.
** However, jurisdictions may be held responsible for other sorts of provisions including paying for services and materials necessary to publish and syndicate the notice information.
* Jurisdictions should not limit access to the information that is published for any reason including jurisdiction, constituency, payment, and authentication for any purpose. However, based on sound and reasonable methods, jurisdiction should be encouraged to limit participation to any criteria that is understood, explicit and based on previously instituted rules, laws and regulations.
* Regardless of any additional methods of conveying the information contained in a public meeting notice, there must be a main method which is both human readable and machine processable.
* Aggregators, re-publishers and value add systems must always link and/or cite to the original and authoritative published version without any additional cost or proscriptions regarding the original content.
# Public Meeting Notices and Agendas/How to Publish an Online and Printable Public Meeting Notice with Agendas

WikiBook eDemocracy eCitizen Public Meeting Notices and Agendas "How To"
How to Publish an Online and Printable Public Meeting Notice with Agendas
* Principles:
** Everything should be at a URL (time/date, location, jurisdiction, agenda items, people)
** Every section of the page itself should be individually at a URL fragment and authoritatively citable and use embedded self-cite recommendation) so that each can have "Share-Like" functions.
** Everything should cite to authoritative source and be citable (self-cites)
** Standards for "Semantic" or "XHTML" for each component (e.g. RDFA for cal/time, microformats for events)
** Include links to alternative standards (e.g. iCal, RSS, etc)
** There should be a QR barcode for online, printed and mobile versions and other versions optionally.
** Every page should use "pop-ups" recommendation ("Preview Online Page Universal Page Standard")
** Point to the Rules under which the meetings will be held
* Processes:
** Applicable Procedures (quorum requirements, other rules for each part of meeting)
** Commenting on Items, etc in advance of meeting.
* Policies
** Public vs. Private
** Authenticated vs Psydonym vs Anonymous Participation and Personalization
** Comment and Participation and Collaboration (including policy and process for entertaining contributions that are not directly germane - e.g. "out of order" or "out of scope" and how those determinations are made for comments and online participation rather than in-meeting live rulings on points of order)
** Proprietariness and Propriety - gift-ban rules on free services? Need for RFP or Public Notice to use Vendor?
* Business and Functional:
** Workflow for Public Employees and Officials (or authorized agents acting on their behalf) to auto-generate or manually create, amend or replace public meeting notices and agendas.
** Required and Recommended Tasks: Publicize Broadly and Inform Relevant Constituencies, etc (check-list)
** Role of "For Profit" "Non Profit" and other External Entities in Providing Services and in the Ecology of this information, communication and collaboration.
* Examples of Meeting Notices and Agenda
** Notice
** Agenda
** Pre-Meeting Phase
** Meeting Phase
** Post-Meeting Phase
** Archive and Access
# Public Meeting Notices and Agendas/Appendix D: List of Organizations and Efforts

Appendix D: List of Organizations and Efforts
# Public Meeting Notices and Agendas/General Requirements

General Requirements
This portion of the book will be based on the requirements gathering process. Each potential requirement must include the following:
* Requirements will be "tagged" with at least one of the following: B (for business process), L (for legal issues/laws/requirements), T (for technological implementation issue) and S (for any sociological aspect such as marketing and perceptions).
* Any inclusion must cite with links to the original material which is the basis of the requirement and supporting material. If the information is new or previously unpublished, the link should be to the author of the idea as a reasonable substitute for the citation.
* Any costs or use restrictions must be explicit. For example, if the there is a specific technology that is made a requirement, there must be an explanation of it. Or if part of the business process requirement entails having a paid position necessary, that must be fully explained.
* Requirements may be specific to different jurisdictions may be included, however, there must be a fully explained and cited description of it.
* Accessibility
# Public Meeting Notices and Agendas/Resources, Standards and Ideas to Consider
## Resources, Standards and Ideas to Consider

| URL | Description | Open, Proprietary, Government Hosted, NGO Hosted, Commercially Hosted |
| http://www.timeanddate.com/worldclock/ | Time URL | CH |
| http://time.gov/ | Time service | GH |
| http://www.w3.org/2006/07/SWD/RDFa/impl/js/rdfa-calendar.html | Time Standard | O |
| http://microformats.org/wiki/hcalendar | Event Standard | O |
| http://www.evite.com/ | Event Service | CH |
# Public Meeting Notices and Agendas/Appendix C: Examples of Existing Systems and Software

Appendix C: Examples of Existing Systems and Software
# Public Meeting Notices and Agendas/Requirements Gathering
## Public Meeting Notice and Agenda Requirements Gathering Process

Note: To help with this page you can:
* go to discussion for this page (in the above tab) and discuss the page,
* edit the list below if necessary, but judiciously, please,
* discuss on your own web site or blog by linking to this page (http://en.wikibooks.org/wiki/Public_Meeting_Notices_and_Agendas/Requirements_Gathering)
* join and send an e-mail to the Public Meetings Online Working Group

### List of Requirements

* Find examples of online and offline public meeting notices
* Find examples of online and offline public meeting agendas and minutes
* Find examples of laws, regulations and bylaws that oversee public meeting notice requirements and how the meeting agenda is set, how the meeting is conducted and how the meeting proceedings are to be made public
* Identify accessibility provisions to all of the above both in terms of notice and meeting accommodations
* Identify online standards that meet the needs for meeting notice and agenda with a special concentration on standards that are open and both human readable and machine processable
** Jurisdiction
** Date and Time
** Busy time and registration (if needed or required)
** Location and Directions
** Legal requirements and citations
*** Cite laws (e.g. sunshine, accessibility, jurisdiction, times)
*** Quorum requirement
*** Rules of the meeting/procedural rules (e.g. link to Roberts Rules, etc.)
*** Archival requirements/notice/minutes/motions considered/approved
** Aggregation and syndication techniques (e.g. RSS)
** Agenda items and meeting notes/minutes
** Media considerations (e.g. published documentation, video/audio, broadcasting, online participation)
* BLT analysis of public meeting notice and agenda (models of the Business requirements, Legal issues and Technology implementation)
* How to check with
# Pulsars and neutron stars
## Pulsars and Neutron Stars

The aim of this wikibooks is to create a book describing theoretical and observational aspects of pulsar astronomy.

## Table of contents

| Introduction Introduction History of pulsar discoveries History of telescopes and instrumentation History of data processing History of observational results History of applications of pulsars History of the theoretical understanding of pulsars (not started) Pulsar people Key discoveries and the literature Mistakes and red herrings in pulsar research Neutron stars and pulsars Neutron star properties Pulsar properties The pulsar population Individual pulsars Related objects Observing pulsars, accessing data files and useful software Observing pulsars Telescopes involved in pulsar research Accessing and processing pulsar data sets Publically available pulsar software Pulse profiles Pulse profiles Analysing single pulses Pulse emission From the pulsar to the Earth The interstellar medium The Sun and interplanetary medium Pulsar rotation measures | Pulsar searching Searching for pulsars Summary of surveys The pulsar timing method Overview of the pulsar timing method Modelling timing residuals Noise in pulsar timing residuals Using pulsars Searching for gravitational waves Pulsar based time standards Using pulsar timing to study (and navigate) the solar system Testing theories of gravity Pulsars in globular clusters Pulsar planets Pulsar glitches and the interior of neutron stars Pulsar glitches The neutron star interior Statistical analysis and numerical recipes Statistical and analysis methods for pulsar research Coordinate systems and reference frames Useful parameters and constants Education and outreach Education and outreach Tutorials and worksheets Unsolved problems (not started) Manuals and computing Tempo2 manual (not started) Temponest manual ptaSimulate manual Introduction to C for pulsar astronomers Introduction to Julia for pulsar astronomers |