Web NDL Authorities SPARQL API Specication

National Diet Library of Japan
Created: March 31th, 2014
Revised: March 31th, 2018; March 31th, 2023

Contents
1 The Outline of the Web NDLA SPARQL API

1.1 SPARQL query API . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
1.2 Authority Record RDF Graph and SPARQL . . . . . . . . . . . . . . . . . . . . . .

2 SPARQL RDF Query Language
2.1
2.2
2.3
2.4
2.5
2.6
2.7
2.8

Basic Syntax . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Groups of Graph Patterns . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Optional Pattern Matching . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
UNION for Matching Alternatives . . . . . . . . . . . . . . . . . . . . . . . . . . . .
RDF Dataset and Graph . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Restricting Values with FILTER . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Solution Sequences and Modiers . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Query Forms and Results . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

3 API Parameters and Result Formats

3.1 XML Result Format . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
3.2 JSON Result Format . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

4 RDF Graph of the Authority Records and Applied Examples

4.1 Authority Records of Personal Name, Family Name and Corporate Name . . . . . .
4.2 Authority Records of Geographical Name, Uniform Title, Subject Heading and Subject Subdivision . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

5 SPARQL 1.1

5.1 Request URI and parameters . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
5.2 New Functionalities of SPARQL 1.1, and Sample Queries . . . . . . . . . . . . . . .
5.3 The Dierences between SPARQL 1.1 endpoint and exsiting ARC2 (1.0 endpoint) .

6 Revision History

2
2
3

7
7
9
10
12
13
14
18
20

24
24
25

26
26
28

31
31
31
34

35

1

1

The Outline of the Web NDLA SPARQL API

The Web NDL Authorities (Web NDLA) stores the name authority information as RDF (Resource
Description Framework) data. RDF data can be queried by SPARQL (SPARQL RDF Query Language), and the Web NDLA has the function to respond the SPARQL query.
This document describes the RDF data structure of the Web NDLA, and explains how to query
it with SPARQL.

1.1

SPARQL query API

1.1.1

Basic SPARQL Query

A user can search any authority data in Web NDLA with SPARQL Query. The next example isa query to nd the authority URI of the subject heading "図書館" (library).
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
SELECT * WHERE {?subj rdfs:label "図書館"}The search result will be returned by sending this query to NDLA though API using the following
procedure.
1.1.2

Request URI and Parameters

A SPARQL query to the Web NDLA is to be requested against the following URI (endpoint).
http://id.ndl.go.jp/auth/ndla

There are two parameters as shown in Table1.
Table 1: Web NDLA API Parametersparameterquery
outputvalue
URL encoded SPARQL query string
result format (xml | json | turtle*) *turtle is for DESCRIBE, CONSTRUCT only

A request to get results as XML is of the following form.
http://id.ndl.go.jp/auth/ndla?query={URL encoded query}&output=xml

With the previous query being URL encoded, the entire request will be the following.
http://id.ndl.go.jp/auth/ndla?query=PREFIX+rdfs%3A+%3Chttp%3A%2F%2Fwww.w3.org%2F
2000%2F01%2Frdf-schema%23%3E%0D%0ASELECT+*+WHERE+%7B%0D%0A%09%3Fsubj+rdfs%3Alabel2+%22%E5%9B%B3%E6%9B%B8%E9%A4%A8%22%0D%0A%7D%0D%0A&output=xml

There are four SPARQL query forms: SELECT to nd values, ASK to see if the matching data
exists, CONSTRUCT to create new RDF graphs with the matching value, and DESCRIBE to obtain an
explanation graph for resources.
For DESCRIBE or CONSTRUCT queries, value turtle can be specied for the result format parameter(output).
SPARQL query will be discussed in chapter 2, and four query forms will be explained in 2.8.
1.1.3

Result Format

As the result of a request, a list of bound variables (for SELECT), an RDF graph (for DESCRIBE andCONSTRUCT) or a truth value (for ASK) will be returned, according to the type of the query.
The format of the binding list and the truth value is varied by the output parameter as shownin Table 2.
Table 2: Web NDLA API output Parameters

output parameter
xml
json

formatXML as speciﬁed in SPARQL Query Results XML Format
JSON as speciﬁed in SPARQL 1.1 Query Results JSON Format

The resulting XML for the previous query (output=xml) will be:<sparql xmlns="http://www.w3.org/2005/sparql-results#"><head><variable name="subj"/></head><results><result><binding name="subj"><uri>http://id.ndl.go.jp/auth/ndlsh/00573385</uri></binding></result></results></sparql>

The detail of XML format and JSON format will be shown in 3.1 and 3.2 respectively.
The result format of RDF graph is shown in Table 3.

1.2

Authority Record RDF Graph and SPARQL

Authority records in the Web NDLA are expressed as RDF graphs. A SPARQL query is constructedwith "patterns to nd in a graph". This section explains the outline of how to write patterns in an
RDF graph as SPARQL query.

3

Table 3: Web NDLA API RDF Graph Formats

output parameterxml
json
turtle1.2.1

FormatRDF/XML format
RDF/JSON format
Turtle format

The RDF Graph of the Authority Record

RDF describes a basic information in a way that a thing (e.g. an authority record = subject) has aproperty or characteristic (predicate) which has a value (object). This subject - predicate - object
relation is called an RDF Triple. Each element of a triple is named (identied) by a URI1 . An
object can be literal instead of a URI.
A set of RDF triples is called an RDF Graph. In an RDF graph, triples that share the same
URI is connected, resulting a large network of information (Figure 1)2 .

Figure 1: Triples are connected via a common URI.

Authority records in the Web NDLA are represented by RDF. Each authority record is identiedby a URI, and the relationship between records (e.g. broader or alternative term) is described as
RDF triple. Thus authority records are connected, and form a large RDF graph (Figure 2).
Moreover, because the Web NDLA references external authorities such as VIAF or LC authorities, the RDF graph of the Web NDLA goes beyond the National Diet Library of Japan, and becomesa part of LOD (Linked Open Data) cloud (The whole model of an authority record will be discussed
in chapter 4).
1 Actually, it is IRI (Internationalized Resource Identiﬁer, the extension of URI so that non ASCII characters canbe appear in an identiﬁer string) that is used for naming. This document uses more familiar URI as the term ofidentiﬁer, but it should be read as IRI.
2 Some nodes might be blank nodes without URIs, which are connected via internal blank node IDs.

4

Figure 2: The subject URI of ”セマンティックウェブ” (Semantic Web, http://…01017771) is also the object ofskos:narrower property of ”インターネット”(Internet, http://…00841024) , hence these triples are connected.

1.2.2

Partial Graph Pattern and SearchWith SPARQL, a user will write a partial pattern of an RDF graph that contains unknown data(variables), nd values that match this pattern from the target graph, and retrieve the result as sets
of values.
For example, in order to nd authorities whose label (rdfs:label) are the narrower terms(skos:narrower) of "インターネット", the partial graph pattern will be as Figure 3.

Figure 3: A partial graph pattern where the variables ’subj2’ and ’label’ represent the narrower term andits label.

The search will nd the matching sub graphs from the Web NDLA, and returns values of thecorresponding variables as in Table 4.
1.2.3

Writing a SPARQL Query

In a SPARQL query, partial graph patterns are expressed with Turtle-like syntax. Unknown elements
are written as variables, whose name begin with a letter ’?’. The partial graph pattern of Fig. 3
will be written as follows.

5

Table 4: The results retrieved by the partial graph pattern

subj2
http://id.ndl.go.jp/auth/ndlsh/01017771
http://id.ndl.go.jp/auth/ndlsh/00969901
http://id.ndl.go.jp/auth/ndlsh/00865280

label
セマンティックウェブ
バーチャルプライベートネットワーク
イントラネット?subj1 rdfs:label "インターネット" ;skos:narrower ?subj2 .
?subj2 rdfs:label ?label .

# Internet

The steps to search the graph with this pattern are:1. If graph patterns use prexed names, map those prexes to URI by keyword PREFIX3 ,2. put keyword SELECT followed by space separated variables to retrieve (similar to columns in
SQL),
3. then put keyword WHERE followed by patterns enclosed by {}.
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
PREFIX skos: <http://www.w3.org/2004/02/skos/core#>
SELECT ?subj2 ?label
WHERE {
?subj1 rdfs:label "インターネット" ;skos:narrower ?subj2 .
?subj2 rdfs:label ?label .
}In this example, two variables ?subj2 ?label are listed after SELECT in order to get the values
shown in Table 4. By writing * instead of variables list, all values of the variables used in the graphpattern will be retrieved4 .
SELECT * WHERE {...

For ASK, CONSTRUCT and DESCRIBE queries, SELECT clause is replaced by each corresponding
construct while PREFIX clause and WHERE clause parts are the same (See 2.8 for detail).
3 Although some of following examples may omit PREFIX clause for simplicity, all preﬁxes must be mapped to
URIs by PREFIX.
4 In these examples, ﬁrst one has a new line before WHERE, while the second one does not. Since a new line
character is regarded as a white space in SPARQL syntax, it does not make any diﬀerence.

6

2

SPARQL RDF Query Language

The Web NDLA uses ARC2 library5 which supports SPARQL Query Language for RDF 1.06 . This
chapter explains SPARQL query that can be used with the Web NDLA.

2.1

Basic Syntax

Most forms of SPARQL query contain a set of triple patterns called a basic graph pattern. These
patterns are expressed by Turtle-like syntax.
2.1.1

Triple Patterns

A triple pattern is like RDF triple except that each of the subject, predicate and object may be
a variable. A triple pattern consists of the following components:• A term enclosed by <> is a URI7 . It can be an absolute URI, or a relative URI combined with
BASE clause.
• A URI can be expressed as a prexed name in the form of prefix:localname. The prexlabel must be associated with a URI by PREFIX clause.
• A value enclosed by "" or ’’ is a literal, with either an optional language tag (introduced by@) or an optional datatype IRI / prexed name (introduced by ^^).
• If a prexed style name starts with _:, it is a blank node in a graph. A blank node can also
be expressed by [] form as in Turtle8 .
• A variable is an alphanumeric string9 prexed by either ? or $. A variable name may containan under bar (_), but not a hyphen (-). Query variables in SPARQL queries have global scope.

A special single character 'a' may be used as an abbreviation of predicate rdf:type which relates
a subject to a class. A user may nd it convenient because PREFIX clause for rdf: is not necessary
if there is no other term from that namespace.
The next is an example of abbreviation 'a' which relates the subject (variable) to foaf:Personclass. This query will nd person entity resources (see 4.1) in the authority records.
PREFIX foaf: <http://xmlns.com/foaf/0.1/>
SELECT * WHERE {?who a foaf:Person}

Without using abbreviation 'a', the above query will be as follows.
5 https://github.com/semsol/arc2
6 http://www.w3.org/TR/rdf-sparql-query/
7 It is actually an IRI in SPARQL, too. This document uses more familiar term URI in place of IRI.
8 Blank nodes in graph patterns act as non-distinguished variables, not as references to speciﬁc blank nodes in thedata. Therefore, they will match even URIs or literals in RDF graph, though those values cannot be retrieved.
9 The Web NDLA does not support non alphanumeric variable names, although SPARQL speciﬁcation permits
them.

7

PREFIX foaf: <http://xmlns.com/foaf/0.1/>
PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
SELECT * WHERE {?who rdf:type foaf:Person}

A character # is a comment marker if presents outside literals and URIs. After the maker up to
the end of line will be a comment.
New line and TAB characters are treated as white spaces.
2.1.2

Datatype and Language Tag in Literal

A literal may be a plain literal, or may have a datatype (e.g. date, integer etc.) or a language tag.
A care should be taken because a plain literal and a typed literal or a language tagged literal aretreated as dierent values even if their lexical forms (string parts) are the same.
• The Web NDLA does not use datatypes. For example, a record creation date is always in theform of "2013-12-15" in the Web NDLA, while it might be expressed as "2013-12-15"^^xsd:datein some other datasets.

• The Web NDLA uses language tags only for the transcriptions of structured labels. For
example, the subject heading "図書館" (library) has two transcriptions "トショカン"@ja-Kanaand "Toshokan"@ja-Latn, so that users can distinguish Japanese-kana and Japanese-romajitranscriptions.

2.1.3

Graph Patterns

A graph pattern is a set of triple patterns. Each triple pattern is delimited by a period (.)10 .
There are abbreviated ways of writing some common triple pattern constructs, same as in Turtle:
The common subject can be abbreviated by ; so that the rest are written as predicate-object list.
The common predicate is abbreviated by , and the rest are just object list.
?subj rdfs:label ?label ;skos:relatedMatch <http://id.ndl.go.jp/class/ndlc/DK341> ,<http://id.ndl.go.jp/class/ndc9/694.5> .

The above example contains three triple patterns which share the common subject ?subj. Also,
the common predicate skos:relatedMatch is omitted in the last line with , at the end of previous
line. Without shortcut, those triple patterns will be written as follows.
?subj rdfs:label ?label .
?subj skos:relatedMatch <http://id.ndl.go.jp/class/ndlc/DK341> .
?subj skos:relatedMatch <http://id.ndl.go.jp/class/ndc9/694.5> .
10 A period is just a delimiter, and not required at the end of a triple pattern (diﬀerent from Turtle), hence it is notnecessary to place a period at the end of a graph pattern.

82.1.4Filters

SPARQL provides FILTER to test or restrict the values. For example, the following query matches
records whose labels contain "夏目" (FILTER will be further explained in the section 2.6).
?uri rdfs:label ?label .
FILTER regex(?label, "夏目")2.2# NatsumeGroups of Graph Patterns

SPARQL graph pattern matching is dened in terms of combining the results from matching basic

graph patterns.

A sequence of triple patterns (with optional lters) comprises a single basic graph pattern. Anyother graph pattern terminates the basic graph pattern.
A set of one or more graph patterns delimited by {} is called group graph pattern. The WHERE
clause of a query consists of the keyword followed by one group graph pattern.
Group graph patterns can be nested.
WHERE {
?subj1 rdfs:label "インターネット" ;skos:narrower ?subj2 .
{?subj2 rdfs:label ?label }}# Internet

In the above example, the WHERE clause has one group graph pattern, within which there are one
basic graph pattern and one group graph pattern. The inner group graph pattern consists of one
basic graph pattern.
2.2.1

Graph Patterns and Filters

A FILTER restricts solutions over the whole group graph pattern in which the lter appears. Within
the same group graph pattern, the lter has the same scope regardless its position.
WHERE {
?subj1 rdfs:label "インターネット" ;skos:narrower ?subj2 .
?subj2 rdfs:label ?label .
FILTER regex(?label, "ネット")
}

# net

The above example has the same solutions as bellow.
WHERE {FILTER regex(?label, "ネット")

9

?subj1 rdfs:label "インターネット" ;skos:narrower ?subj2 .
?subj2 rdfs:label ?label .
}

2.2.2

Graph Patterns and Blank Node ID

Labels for blank nodes (blank node IDs) are scoped to the basic graph pattern. A label can be usedin only a single basic graph pattern in any query11 . Therefore, the following example is valid:
WHERE {
?subj1 rdfs:label "インターネット" ;skos:narrower _:s2 .
_:s2 rdfs:label ?label .
}while the next one is an error.
WHERE {
?subj1 rdfs:label "インターネット" ;skos:narrower _:s2 .
{_:s2 rdfs:label ?label }}In the second example, the inner {} divides the query into two basic graph patterns, whichcannot share the same blank node id (_:s2 in this case).

2.3

Optional Pattern Matching

In a query with basic graph patterns, all variables in the query must have matches to have a solution.
For example, in the next query, narrower terms of "インターネット" will not be retrieved unlessthey have their related terms.
SELECT ?subj2 ?label ?subj3 ?rels
WHERE {
?subj1 rdfs:label "インターネット" ;skos:narrower ?subj2 .
?subj2 rdfs:label ?label ;skos:related ?subj3 .
?subj3 rdfs:label ?rels .
}11 Although blank nodes act like variables, their scope is diﬀerent from that of variable which is global.

10In order to make non-required variables optional, enclose the partial graph that contain thosevariables as a group graph pattern, then concatenate it to the required pattern by OPTIONAL keyword.
SELECT ?subj2 ?label ?subj3 ?rels
WHERE {
?subj1 rdfs:label "インターネット" ;skos:narrower ?subj2 .
?subj2 rdfs:label ?label .
OPTIONAL {?subj2 skos:related ?subj3 .
?subj3 rdfs:label ?rels .
}}The above query will nd all narrower terms of "インターネット", as well as the related termsof them if they have any.
2.3.1

Multiple Optional Patterns

A query can have multiple OPTIONAL patterns.
pattern 1 OPTIONAL {pattern 2} OPTIONAL {pattern 3}

Those patterns are left-associative. The above one is the same as the next:{pattern 1 OPTIONAL {pattern 2}} OPTIONAL {pattern 3}

2.3.2

OPTIONAL and FILTERA FILTER can be applied to an optional pattern. The next example is a query that will ndthe narrower terms of "インターネット" and also nd their related terms which contain "情報"(information).
SELECT ?subj2 ?label ?subj3 ?rels
WHERE {
?subj1 rdfs:label "インターネット" ;skos:narrower ?subj2 .
?subj2 rdfs:label ?label .
OPTIONAL {?subj2 skos:related ?subj3 .
?subj3 rdfs:label ?rels .
FILTER regex(?rels, "情報")}}11Note that the scope of a FILTER is the group graph pattern. If the FILTER keyword is placedoutside the OPTIONAL pattern as in the next example, it will aect the entire WHERE clause.
SELECT ?subj2 ?label ?subj3 ?rels
WHERE {
?subj1 rdfs:label "インターネット" ;skos:narrower ?subj2 .
?subj2 rdfs:label ?label .
OPTIONAL {?subj2 skos:related ?subj3 .
?subj3 rdfs:label ?rels .
}FILTER regex(?rels, "情報")}Because this FILTER examines whether ?rels contains "情報" for all solutions, any solution
where the narrower term does not have related term (no binding for ?rels) will be excluded fromthe results set.

2.4

UNION for Matching Alternatives

To nd results that match any of alternative patterns, join group graph patterns by UNION keyword.
For example, the next query will nd subject headings that have classication code ND633
from National Diet Library Classication (NDLC) or 547.483 from Japan Decimal Classication 9thedition (NDC9).
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
PREFIX skos: <http://www.w3.org/2004/02/skos/core#>prefix xl: <http://www.w3.org/2008/05/skos-xl#>
prefix ndl: <http://ndl.go.jp/dcndl/terms/>
SELECT *WHERE {{
?subj
skos:relatedMatch <http://id.ndl.go.jp/class/ndlc/ND633> ;rdfs:label ?dcndl .
} UNION {?subj
skos:relatedMatch <http://id.ndl.go.jp/class/ndc9/547.483> ;rdfs:label ?ndc9 .
}
}

12

2.5

RDF Dataset and GraphA SPARQL query is executed against an RDF Dataset which represents a collection of graphs.
An RDF Dataset comprises one default graph, which does not have a name, and zero or more
named graphs, each of which is identied by an URI.
A query involves any of graphs in a dataset. The graph that is used for matching a basic graphpattern is the active graph. GRAPH keyword (see 2.5.1) species the active graph. If it does notpresent, the default graph is used as the active graph.
The dataset in the Web NDLA consists of two named graphs shown in Table 5.
Table 5: Graphs in Web NDLA dataset

data type
Subject Headings
Name Authorities

graph URI
http://id.ndl.go.jp/auth/ndlsh
http://id.ndl.go.jp/auth/ndlna

Also, the merge of those two graphs is the default graph in the Web NDLA.
2.5.1

GRAPH Keyword

In a WHERE clause, a GRAPH followed by a graph URI will set the active graph. After the URI, place
the group graph pattern to search against this active graph.
SELECT * WHERE {GRAPH <http://id.ndl.go.jp/auth/ndlna> {?s rdfs:label "インターネット"}}

The above example will nd "インターネット" in the Name Authority graph ("インターネット"
as a corporate name will match).
If a variable follows GRAPH keyword, the result will have the graph URI where the group graphpattern has match.
SELECT * WHERE {GRAPH ?g {?s rdfs:label "インターネット"}}

The above query returns the result shown in Table 6, which tells that each of Subject Heading
and Name Authority has a record "インターネット".
With multiple GRAPH keywords, a query will be executed against each graph. The same variable
can be used across those graphs.
The next example will nd the records that share the same labels in Subject Heading and Name
Authority by using the same variable ?label for both graphs.

13

Table 6: The search result of ”インターネット” with graph name as variableg
http://id.ndl.go.jp/auth/ndlsh
http://id.ndl.go.jp/auth/ndlnas
http://id.ndl.go.jp/auth/ndlsh/00841024
http://id.ndl.go.jp/auth/ndlna/001144835

SELECT * WHERE {GRAPH <http://id.ndl.go.jp/auth/ndlsh> {?sh rdfs:label ?label}
GRAPH <http://id.ndl.go.jp/auth/ndlna> {?na rdfs:label ?label
}
}

2.5.2

FROM Clause

A clause FROM <graph URI> before WHERE clause indicates the graph to be used to form the default
graph. FROM NAMED <graph URI> will introduce that graph as a named graph. Those keywords canbe used multiple times (i.e. the query will be executed against multiple graphs).
In the Web NDLA, FROM clause acts to restrict the target graph12 . The next example will nd "インターネット" in the Name Authority, and have the same results as the query with GRAPH keyword.
SELECT *FROM <http://id.ndl.go.jp/auth/ndlna>
WHERE {?s rdfs:label "インターネット"}

2.6

Restricting Values with FILTERFILTER restricts solutions that match the graph pattern, by excluding solutions where any FILTER
expression evaluates to FALSE.
?book ex:price ?price .
FILTER (?price < 2000)

In the above example, only solutions whose ?price value is less than 2000 will be returned,
others being excluded from the matching sets.
12 Some services introduce external dataset by FROM, although the Web NDLA does not. FROM and FROM
NAMED behave identically in the Web NDLA: speciﬁed graph will be incorporated to both default graph and named
graph.

14

2.6.1Comparison and Logical Operators

Like many programming languages, FILTER expression can have comparison and logical operators
shown in Tables 7 and 8 respectively. An expression has to be enclosed by ().
Table 7: SPARQL Comparison Operators

Operator
A = B
A != B
A > B
A < B
A >= BA <= B

TRUE condition
A is equal to B
A is not equal to B
A is greater than B
A is less than B
A is greater than or equal to B
A is less than or equal to B

Table 8: SPARQL Logical Operators

Operator
A || B
A && B! A

TRUE condition
Either A or B is TRUE (OR)Both A and B are TRUE (AND)Not A (NOT)

Expressions are evaluated based on the data types of A and B. Suppose A is 10 and B is 5, theexpression A > B evaluates to TRUE if those are numeric values, and to FALSE if string values. A
and B must have the same types to be compared. In the Web NDLA, all literal values are strings (nodata type), however, they are converted to numbers automatically if both A and B can be treatedas numerical values13 .
For numerical values, arithmetic operators can be applied. The next example restricts thesolutions to have 10 or more dierence between max and min values.
?what ex:height ?max ；ex:low ?min .
FILTER (?max - 10 >= ?min)2.6.2

Test Functions

Functions in Table 9 are provided to test values, e.g. whether they are literals, blank nodes etc.
The combination of OPTIONAL pattern and negation of bound() can be used to nd solutions
that do NOT have a value of particular property. The next example will nd any living person (whohas birth date but does not have death date).

13 In general, use accessors such as STR() in 2.6.3 to align data types when operands have diﬀerent types.

15

Table 9: SPARQL Test Functions

Functionbound(A)isIRI(A)isURI(A)
isBLANK(A)isLITERAL(A)TRUE condition
A is bound to a value
A is an IRI
A is a URI
A is a blank node
A is a literal

PREFIX foaf: <http://xmlns.com/foaf/0.1/>
PREFIX rda: <http://RDVocab.info/ElementsGr2/>
SELECT * WHERE {?who a foaf:Person; foaf:name ?name ;rda:dateOfBirth ?bdate .
OPTIONAL {?who rda:dateOfDeath ?ddate.
}
FILTER (!bound(?ddate))}

Note that dateOfDeath has to be OPTIONAL. Otherwise, the graph pattern requires ?ddate while
FILTER excludes results that have matching ?ddate, resulting empty solution set14 .
2.6.3

Accessors

Operators in Table 10 are accessors to obtain values other than truth value.
Table 10: SPARQL Accessors

Operatorstr(A)
lang(A)
datatype(A)Return Valuethe lexical form of A (simple string)language tag value of A
datatype URI of A

For example, with lang() accessor, a user can retrieve Romaji transcription of headings thatmatch a pattern.
PREFIX xl: <http://www.w3.org/2008/05/skos-xl#>
PREFIX ndl: <http://ndl.go.jp/dcndl/terms/>
SELECT * WHERE {?uri xl:prefLabel [ ndl:transcription ?yomi ] ;14 SPARQL 1.1 provides more intuitive negation, e.g. FILTER NOT EXISTS ?who rda:dateOfDeath ?ddate.

16

#any graph pattern
FILTER (lang(?yomi) = "ja-Latn")
}

2.6.4

Regular Expressions

The regular expression, introduced by regex() function, is a method to evaluate a string with
exible pattern. Partial matching to a string is also executed by a regular expression function.
The Web NDLA supports regular expression notations in Table 1115 .
Table 11: The Web NDLA Regular Expression

Notation
.
*
+
?
^
$
()
|
{}
[...]
[^...]

Functionality
matches any single character
matches zero or more times of the pattern immediately before
matches one or more times of the pattern immediately before
matches zero or one of the pattern immediately before
matches the head of a string
matches the tail of a stringgrouping the enclosed patterns
choice of a pattern in a group (OR)speciﬁes the number of repetition of the pattern immediately before
character class (set or range of characters)
negation of the character class

The regular expression function is used in a form of regex(text, pattern). For partial match,
the pattern is the desired partial string.
For example, following query will nd headings that contain "図書館".
SELECT * WHERE {?uri rdfs:label ?label .
FILTER regex(?label, "図書館")}

The next query will nd headings that consist of three capital letters.
SELECT * WHERE {?uri rdfs:label ?label .
FILTER regex(?label, "^[A-Z]{3}$")}15 SPARQL Regular Expression follows the deﬁnition in XQuery/XPath speciﬁcation, however, the Web NDLA
does not support escape and meta characters with backslash at this moment.

17

The regex() function may have a ag as the third argument that controls matching behavior.
The Web NDLA supports "i" ag that makes the search case-insensitive. In the next query, ?label
will match either "internet", "Internet" or "INTERNET".
SELECT * WHERE {?uri rdfs:label ?label .
FILTER regex(?label, "internet", "i")}A FILTER can have multiple expressions combined by a logical operator. The next query will
nd headings that contain either "インターネット" or "Internet".
SELECT * WHERE {?uri rdfs:label ?label .
FILTER ( regex(?label, "インターネット") || regex(?label, "Internet") )}Note concatenation of two expressions by && is equivalent to writing two FILTER clauses.

2.7

Solution Sequences and Modiﬁers

Sequence modiers canbe used to make solutions an ordered sequence or to restrict numbers ofsolutions.
2.7.1

LIMIT and OFFSET

LIMIT clause after WHERE clause restricts the maximum number of solutions to be returned. OFFSET

clause controls the starting solution to be returned in whole sequence.
The next example will return the rst 10 headings.
SELECT * WHERE {?uri rdfs:label ?label} LIMIT 10

The next example will return headings from 6 to 10 (OFFSET species how many solutions to be
skipped from the top). The order of LIMIT and OFFSET clauses is not signicant.
SELECT * WHERE {?uri rdfs:label ?label} LIMIT 10 OFFSET 5

At this moment, the Web NDLA is congured to return at most 100 results. Therefore, themaximum number of results per request is 100, even if LIMIT clause tells more. Please use OFFSET
clause in order to get results after 101.

18

SELECT * WHERE {?uri rdfs:label ?label} OFFSET 100

2.7.2

Sorting

ORDER BY keyword followed by space separated sort key variables establishes the order of the solution
sequence. DESC() / ASC() modiers indicate the enclosed variable is a descending / ascending key,

respectively. Without enclosing modier, a variable is treated as an ascending key.
SELECT * WHERE {?uri rdfs:label ?label ;dct:modified ?moddate .
} ORDER BY ?moddate

Order modiers can be combined with LIMIT and OFFSET clause to retrieve the sorted slice ofthe solutions. In this case, write ORDER BY rst, then LIMIT and OFFSET.
2.7.3

Eliminating Duplications

In some graph patterns, it is possible that some solutions share the same set of bindings fromvariables to values. DISTINCT modier after SELECT ensures that those duplications are eliminatedfrom the solution set.
SELECT DISTINCT ?type WHERE {?s a ?type .
}REDUCED modier also eliminates duplications, but does not guarantee uniqueness. While bothmodiers generate the same solution set in most cases, REDUCED would return the results faster forlarge data sets, since the heavy computational burden required by complete elimination would be
obviated.
2.7.4

Aggregates

Aggregates such as grouping the solutions and counting the number of results are introduced in
SPARQL 1.1. Although the Web NDLA (ARC2 library) implements SPARQL 1.0, there are someaggregate functions available.
In order to count the number of the results, use set function COUNT() with the target variable asits argument, and assign the counted number to a new variable by AS keyword, in SELECT clause.
For example, the next query will nd the number of authority records of people who were born in
1960, in the Web NDLA.

19

SELECT (COUNT(?who) AS ?howmany) WHERE {?who rda:dateOfBirth "1960" .
}GROUP BY keyword followed by variables, after WHERE clause, divides results into groups. Thenthe aggregate value is calculated for each group. The next example will nd the year-by-year numberof authority records of people who were born in 1900 or later.
SELECT ?byear (COUNT(?who) AS ?howmany) WHERE {?who rda:dateOfBirth ?byear .
FILTER (?byear >= 1900)} GROUP BY ?byear
ORDER BY ?byear

Set functions for aggregates are MAX(), MIN(), AVG() and SUM() as well as COUNT() (AVG() andSUM() are applicable only for numerical values). The next example will nd the latest and the oldest
year of birth in authority records of personal name.

SELECT (MIN(?byear) AS ?past) (MAX(?byear) AS ?recent) WHERE {?who rdf:dateOfBirth ?byear .
}2.8

Query Forms and Results

SPARQL has four query forms: SELECT, ASK, CONSTRUCT and DESCRIBE.
2.8.1

SELECTTo nd the values that match the pattern, use SELECT query.
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
PREFIX skos: <http://www.w3.org/2004/02/skos/core#>
SELECT ?subj2 ?label
WHERE {
?subj1 rdfs:label "インターネット" ;skos:narrower ?subj2 .
?subj2 rdfs:label ?label .
}With the above SELECT query, the Web NDLA will return the following results (for XML format).

20

<sparql xmlns="http://www.w3.org/2005/sparql-results#"><head><variable name="subj2"/><variable name="label"/></head><results><result><binding name="subj2"><uri>http://id.ndl.go.jp/auth/ndlsh/00969901</uri></binding><binding name="label"><literal>バーチャルプライベートネットワーク</literal></binding></result><result><binding name="subj2"><uri>http://id.ndl.go.jp/auth/ndlsh/00865280</uri></binding><binding name="label"><literal>イントラネット</literal></binding></result><result><binding name="subj2"><uri>http://id.ndl.go.jp/auth/ndlsh/01017771</uri></binding><binding name="label"><literal>セマンティックウェブ</literal></binding></result></results></sparql>

The <head> element enumerates the variable names in the results set, and the <results> element
contains <result> elements for each matching variable set. See 3.1 for the detail of the result format.
2.8.2

ASK

To determine whether there are any partial graphs that match the pattern (without retrieving thevalues), use ASK query. Because this query ignores variable values, the keyword is immediately
followed by the WHERE clause.
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
ASK WHERE {21

?subj1 rdfs:label "インターネット"}

With the above ASK query, the Web NDLA will return the following results (for XML format).
<sparql xmlns="http://www.w3.org/2005/sparql-results#"><head></head><boolean>true</boolean></sparql>

If no matching partial graph is found, the content of <boolean> is false.
2.8.3

CONSTRUCTThe matching variable values can be used to construct another RDF graph. Write the pattern ofthe new graph with similar syntax, put it in {} after the keyword CONSTRUCT, then place the WHERE
clause.
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
PREFIX skos: <http://www.w3.org/2004/02/skos/core#>
PREFIX ex: <http://example.org/terms#>
CONSTRUCT {?subj1 ex:下位語 ?label .
# 下位語 means narrower term}
WHERE {
?subj1 rdfs:label "インターネット" ;skos:narrower ?subj2 .
?subj2 rdfs:label ?label .
}With the above CONSTRUCT query, the Web NDLA will return the following graph (for Turtle
format).
@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
@prefix ns0: <http://example.org/terms#> .
<http://id.ndl.go.jp/auth/ndlsh/00841024>
ns0:下位語 "バーチャルプライベートネットワーク" ,"イントラネット" ,"セマンティックウェブ" .

# virtual private network# Intranet# Semantic Web

Note the prexes in the returned Turtle might be dierent from those specied in the query.
If output parameter is xml, the graph is returned in RDF/XML format.

22

2.8.4DESCRIBE

With DESCRIBE query, a user can retrieve an RDF graph which is about the resources (variablevalues) that match the condition. In the Web NDLA, this will be a "description graph" that consistsof triples whose subjects are the value URIs, plus triples connected to them via blank nodes.
DESCRIBE <http://id.ndl.go.jp/auth/ndlsh/00841024>

With the above DESCRIBE query, the Web NDLA will return the same RDF graph as to be
retrieved from the URI with sux .ttl or .rdf.
A description graph can be obtained for the resources that match a graph pattern in WHERE clause.
If there are multiple matches or multiple variables are specied, the merge of the "description graphs"
will be returned.
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
PREFIX skos: <http://www.w3.org/2004/02/skos/core#>
DESCRIBE ?subj2
WHERE {
?subj1 rdfs:label "インターネット" ;skos:narrower ?subj2 .
?subj2 rdfs:label ?label .
}The "description graph" will be empty if the value of the variable is a literal.

23

3

API Parameters and Result Formats

An API request is to be sent to the following URI, with URL encoded query string as queryparameter value and result format as output parameter value, as shown in 1.1.2.
http://id.ndl.go.jp/auth/ndla

The variables binding list and TRUTH value, as the result of SELECT and ASK query respectively,
will be returned with XML or JSON result format according to output parameter value.

3.1

XML Result Format

When the output parameter value is xml, the result set is returned in SPARQL Query Results XML
Format16 .
This format is, as shown in the example in 2.8.1, an XML document in namespace http://www.w3.org/2005/sparql
whose root sparql element has head and results (boolean for ASK query) elements.
The head element has variable elements in query order, where name attribute is the name ofeach variable. The head element is empty for ASK query.
<head><variable name="subj2"/><variable name="label"/></head>The results element contains zero or more result elements which have binding elements
for each bound variable. A binding element has a name attribute corresponding to the name ofvariable, and has one child element <uri>, <literal> or <bnode> (depending on the value type)whose content is the value of the variable.
If the value is literal and has language tag, <literal> has xml:lang attribute. If it is a typed
literal, the element has datatype attribute whose value is the datatype URI.
<results><result><binding name="subj2"><uri>http://id.ndl.go.jp/auth/ndlsh/00969901</uri></binding><binding name="label"><literal>バーチャルプライベートネットワーク</literal></binding></result>...
</results>

16 http://www.w3.org/TR/rdf-sparql-XMLres/

24

For ASK query, there is a <boolean> element instead of <results>, whose content is true or
false, as shown in the example in 2.8.2.

3.2

JSON Result Format

When the output parameter value is json, the result set is returned in SPARQL 1.1 Query Results
JSON Format17 .
This is a JSON document whose top most object has head and results (boolean for ASK query)property. The result in JSON format for the query in 2.8.1 will be as follows.
{"head": {"vars": ["subj2","label"]},"results": {"bindings": [{"subj2": {"type": "uri","value": "http://id.ndl.go.jp/auth/ndlsh/00969901"},"label": {"type": "literal","value": "\u30d0\u30fc\u30c1\u30e3\u30eb\u30d7\u30e9..."
}
},
....
]
}
}

The head property value is an object which has a vars property, whose value is an array ofvariable names.
The results property is an object which has a bindings property, whose value is an array ofobjects of result sets, where bound variable names are properties. Each property value is an object,which has a type property to tell whether the value is URI, blank node or literal, and a value
property to show the value.
Note that value property value will be escaped as \u + Unicode number for non-ASCII characters, as shown in the above example.

17 http://www.w3.org/TR/sparql11-results-json/

25

4

RDF Graph of the Authority Records and Applied Examples

This chapter explains the model (graph structure) of the authority records in the Web NDLA, andpresents some examples to apply SPARQL constructs discussed in the previous chapters against thegraph.

4.1

Authority Records of Personal Name, Family Name and Corporate
Name

The authority record resource is distinguished from the entity resource that corresponds to the realworld thing (person etc.) in the graph of personal name, family name and corporate name.
An authority record has such properties as preferred label, alternative label, source and related
link, to name the few. Preferred label and alternative label have structures via blank nodes in orderto provide literal forms and yomi (transcriptions) together.
An entity resource describes such real world attributes as birth year of a person, establish year
or history of a corporate. An authority record resource and its corresponding entity resource are
related by foaf:primaryTopic (Figure 4).
4.1.1

To Find Birth Year, Preferred Label and Kana Transcription of a Person

Provided that a person's name is known, compose a SELECT query where the name is the object of
foaf:name and other values in question are variables.
PREFIX rda: <http://RDVocab.info/ElementsGr2/>
PREFIX foaf: <http://xmlns.com/foaf/0.1/>
PREFIX xl: <http://www.w3.org/2008/05/skos-xl#>
PREFIX ndl: <http://ndl.go.jp/dcndl/terms/>
SELECT * WHERE {?authfoaf:primaryTopic ?entity ;xl:prefLabel [
xl:literalForm ?preflabel ;ndl:transcription ?yomi ] .
?entity
rda:dateOfBirth ?birth ;rda:dateOfDeath ?death ;foaf:name "夏目漱石".
# Natsume, Soseki
FILTER (lang(?yomi) = "ja-Kana")}

Note that preferred label and rdfs:label value are normalized in the form of family name, rstname and birth-death year, e.g. "夏目, 漱石, 1867-1916". The above example uses foaf:name of theentity resource to search with a common name format such as concatenated name (for Japanese) orrst name then last name form.

26

Figure 4: Name authority graph of ”夏目漱石”. A node .../ndlna/00054222 in the left of the ﬁgure represents
the authority record, and .../entity/00054222 at the top represents the entity resource.

27

Since the preferred label has both Kana and Romaji yomi (ndl:transcription), use FILTER to
restrict the language tag.
4.1.2

To Search Person Born in 11th Century, Find VIAF Link and Sort by BirthYear

To nd person born in 11th century, express the condition "born between 1001 and 1100" with thelogical operator in the FILTER clause18 . An authority record links to VIAF with skos:exactMatch.
Variable ?birth is used to sort the result in addition to FILTER expressions.
PREFIX rda: <http://RDVocab.info/ElementsGr2/>
PREFIX foaf: <http://xmlns.com/foaf/0.1/>
PREFIX skos: <http://www.w3.org/2004/02/skos/core#>
SELECT * WHERE {?authfoaf:primaryTopic [rda:dateOfBirth ?birth ;foaf:name ?name ] ;skos:exactMatch ?viaf .
FILTER (xsd:integer(?birth) >= 1001 && xsd:integer(?birth) <= 1100)} ORDER BY ?birth

Note that the Web NDLA does not allow more than 100 results to be retrieved for a single
request. Use OFFSET clause repeatedly to get more than 100 results (See 2.7.1).

4.2

Authority Records of Geographical Name, Uniform Title, Subject
Heading and Subject Subdivision

These authority records do not have corresponding entity resources, hence they have at structure
graphs (though preferred label and alternative label have their substructures to provide literal form
and transcriptions together). Subject headings have more properties than name authorities in orderto describe broader, narrower, related terms or classications (Figure 5).
4.2.1

To Find Broader or Narrower Terms of Subject Heading

Since subject headings are not normalized as name authorities, simply use rdfs:label as the property of the known heading, and let broader or narrower terms be variables. The next example will
nd the broader term of "インターネット".
PREFIX skos: <http://www.w3.org/2004/02/skos/core#>
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
SELECT * WHERE {18 Since the values of rda:dateOfBirth are plain literal, those must be converted to numerical e.g. xsd:integer inorder to proper comparison. While the Web NDLA SPARQL 1.0 endpoint can handle this FILTER without suchcasting functions, SPARQL 1.1 endpoint returns empty result without them.

28

Figure 5: RDF graph of subject heading ”インターネット”. Some narrower and related terms are omitted
for simplicity.

29

?subjrdfs:label "インターネット" ;skos:broader ?broader .
?broader rdfs:label ?label .
}

4.2.2

To Find Subject Headings with Some Classiﬁcations

In order to nd subject headings that have classication of NDLC "DM225" which is identied by
a URI, construct a query with that URI as the object of skos:relatedMatch.
PREFIX skos: <http://www.w3.org/2004/02/skos/core#>
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
SELECT * WHERE {?subjskos:relatedMatch <http://id.ndl.go.jp/class/ndlc/DM225> ;rdfs:label ?label .
}To nd subject headings classied as both NDLC "DK341" and NDC9 "694.5", let the graphpattern have two objects of skos:relatedMatch (NDC9 is also identied by a URI, with dierent
base URI).
PREFIX skos: <http://www.w3.org/2004/02/skos/core#>
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
SELECT * WHERE {?subjskos:relatedMatch <http://id.ndl.go.jp/class/ndlc/DK341> ,<http://id.ndl.go.jp/class/ndc9/694.5> ;rdfs:label ?label .
}

30

5

SPARQL 1.1

A SPARQL 1.1 endpoint (based on Virtuoso) was introduced in FY2017 as a trial viersion. The
existing SPARQL 1.0 endpoint (explained in the previous sections) is still available, too.

5.1

Request URI and parameters

The endpoint URI of the new service is as follows:
http://id.ndl.go.jp/auth/ndla/sparql

It uses two parameters shown in table 12.
Table 12: Web NDLA API parametersparametaer
query
formatvalue
SPARQL 1.1 query (should be URL encoded)
result format (xml | json | turtle | csv | html)• In case of SELECT and ASK query, the results set for xml, json, csv will be in SPARQL
Query Results Formats as in each specication. The results set for turtle will be RDF graphserialized by Virtuoso.

• In case of DESCRIBE, CONSTRUCT query, the results set is RDF/XML for xml, JSON-LD Expanded Form19 for json, and CSV (each line corresponds to a triple) for csv. Normal Turtle
will be returned for turtle.

The maximum number of results per request is 1000.

5.2

New Functionalities of SPARQL 1.1, and Sample QueriesThis section explains some major functionalities introdued by SPARQL 1.1. See the SPARQL 1.1
Query Language specication20 (SPARQL 1.1 spec) for details.
5.2.1

Negation

Filtering of query solutions is done within a FILTER expression using NOT EXISTS (SPARQL 1.1
spec §8)。
The following is an example to query the authority records which do not have transcriptions of
the preferred label.

19 All URIs, including properties, are expanded to full absolute form
20 http://www.w3.org/TR/sparql11-query/31

PREFIX xl: <http://www.w3.org/2008/05/skos-xl#>
PREFIX ndl: <http://ndl.go.jp/dcndl/terms/>
SELECT * WHERE {?id xl:prefLabel ?xl .
?xl xl:literalForm ?label .
FILTER NOT EXISTS {?xl ndl:transcription ?yomi }} LIMIT 10

5.2.2

Property Paths

Property paths allow for more concise expressions for some SPARQL basic graph patterns (SPARQL
1.1 spec §9).
The following is an example of the * operator to query all 'narrower' subject headings of "図書館".
PREFIX skos: <http://www.w3.org/2004/02/skos/core#>
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
SELECT ?sub ?label WHERE {?top rdfs:label "図書館" ;skos:narrower* ?sub .
?sub rdfs:label ?label .
}

5.2.3

Assignment

The BIND form allows a value to be assigned to a variable from a basic graph pattern or property
path expression (SPARQL 1.1 spec §10).
The follwing example selects the narrower subject headings of "図書館" and their classications,
extracts classication numbers from the URIs, then assigns a variable (?ndc) to them and sort theresults by NDC order using the variable.
PREFIX skos: <http://www.w3.org/2004/02/skos/core#>
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
SELECT ?sub ?label ?ndc WHERE {?top rdfs:label "図書館" ;skos:narrower* ?sub .
?sub rdfs:label ?label ;skos:relatedMatch ?rel.
FILTER(regex(?rel, "^http://id.ndl.go.jp/class/ndc9/"))
BIND (strafter(str(?rel), "ndc9/") as ?ndc)} ORDER BY ?ndc

32

5.2.4Aggregates

Aggregates apply expressions over groups of solutions (SPARQL 1.1 spec §11). The GROUP BY andsome set functions e.g. COUNT() are already available in the existing ARC2 endpoint (see §2.7.4).
The combination of the Aggregates and Assignment makes more exible queries possible.
The following example lists the number of NDC classications assigned to subject headings,
aggregated by the NDC Classes (top level categories).
PREFIX skos: <http://www.w3.org/2004/02/skos/core#>
SELECT ?ndc (count(?id) as ?count) WHERE {?id skos:relatedMatch ?rel.
FILTER(regex(?rel, "^http://id.ndl.go.jp/class/ndc9/"))
BIND (substr(str(?rel), 32, 1) as ?ndc)} GROUP BY ?ndc ORDER BY ?ndc

5.2.5

Subqueries

Subqueries are a way to embed SPARQL queries within other queries, normally to achieve results
which cannot otherwise be achieved (SPARQL 1.1 spec §12).
The following example queries the narrower subject headings of "図書館", counts further narrower
headings of each result, and returns them with corresponding labels.
PREFIX skos: <http://www.w3.org/2004/02/skos/core#>
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
SELECT ?sub ?label ?count WHERE {?top rdfs:label "図書館" ;skos:narrower ?sub .
?sub rdfs:label ?label .
{SELECT ?sub (count(?ssub) as ?count) WHERE{?sub skos:narrower ?ssub .
}
}
}

33

5.3

The Diﬀerences between SPARQL 1.1 endpoint and exsiting ARC2
(1.0 endpoint)

Due to the limitation of Virtuoso, language tags of transcriptions are all lower-cased. While thequery gateway maps the normal lang tags to lower-cased ones in query, the returned results sets willcontain lower-cased language tags.
For the following query:
PREFIX xl: <http://www.w3.org/2008/05/skos-xl#>
PREFIX ndl: <http://ndl.go.jp/dcndl/terms/>
SELECT ?yomi WHERE {?id xl:prefLabel [
xl:literalForm "蔬菜" ;ndl:transcription ?yomi]} LIMIT 1

in the existing ARC2 endpoint, the returned value of bindings in JSON result format is:{"yomi": {"type": "literal","value": "Sosai","xml:lang": "ja-Latn"}}

while it will be as follows in SPARQL 1.1:{
"yomi": {"type": "literal","value": "Sosai","xml:lang": "ja-latn"}}

Notice the dierence of xml:lang values.

34

6

Revision History• 2018-03-31：Added §5 according to the SPARQL 1.1 endpoint test service. Also minor changes

in the description of the SPARQL 1.1 in the document.

• 2023-03-31：A correction in query example in the Test Functions (2.6.2). Added note on typed

literal comparison in the Applied Examples (4.1.2).

35