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 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.
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 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 a better idea of what you can do with it, and ...