O'Reilly logo

Learning SPARQL, 2nd Edition by Bob DuCharme

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Chapter 5. Datatypes and Functions

In earlier chapters we’ve already seen some use of datatypes and functions in SPARQL queries. These are overlapping topics, because queries often use functions to get the most value out of datatypes. In this chapter, we’ll look at the big picture of what roles these topics play in SPARQL and the range of things they let you do:

Datatypes and Queries

RDF supports a defined set of types as well as customized types, and your SPARQL queries can work with both.

Functions

Functions let your queries find out about your input data, create new values from it, and gain greater control over typed data. In this section, we’ll look at the majority of the functions defined by the SPARQL specification.

Extension Functions

SPARQL implementations often add new functions to make your development easier. In this section, we’ll see how to take advantage of these and what kinds of things they offer.

Datatypes and Queries

Does “20022” represent a quantity, a Washington DC postal code, or an ISO standard for financial services messaging? If we know that it’s an integer, we know that it’s more likely to represent a quantity. On the other hand, if we know that it’s a string, it’s more likely to be an identifier such as a postal code, the identifier of an ISO standard, or a part number.

Decades before the semantic web, the storing of datatype metadata was one of the earliest ways to record semantic information. Knowing this extra bit of information about a piece of data gives you ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required