Michele Pasin / Quotes

SPARQL operator mapping and type errors

This behavior is due to something in the SPARQL specification which most everyday SPARQL users likely never worry about – the Operator Mapping [1]. What is happening is that the SPARQL engine is selecting different implementations of the operators to use based on the arguments provided to them.

In our first two examples, both arguments are valid numeric terms so the SPARQL implementation will use numeric equality/inequality; hence, we get true/false as appropriate. In the third example, however, because one argument is an invalid numeric term the implementation cannot select numeric equality and instead selects RDF term equality. This returns true if, and only if, the terms are identical; otherwise, it produces a type error, it is this type error which results in no value for our third query.

SPARQL specifies that an implementation chooses the most appropriate operator implementation available and allows implementations to extend the Operator Mapping with additional datatypes if they so desire. This is why in some implementations you could legally get different results if your implementation understood how to turn “xyz”^^xsd:integer into a valid integer.

Type Errors?

Right now, you are probably wondering what exactly a type error is. Essentially, this is how SPARQL accounts for the fact that data is often messy. Often RDF data is generated or extracted from existing real world data sources that themselves contain errors and inconsistencies; this results in RDF data that often contains those same errors and inconsistencies.

Any expression in SPARQL expects its arguments to conform to certain datatypes; if they do not, then that expression will produce a type error. Type errors propagate up expression trees and may have different effects depending on the type of expression being used.

This is particularly relevant for operators like != because typically SPARQL defines them to be logical negation of their = equivalent, as logical negation of an error is still an error.

Saved 22 August 2013 / yarcdata.com ↗

#RDF-data #datatypes

Typed literals and external datatypes

The common practice in programming languages or database systems is to provide this additional information about how to interpret a literal by associating a…

Rdf Primer #language #programming-language #RDF #literals #datatypes

Typed literals need datatype-aware software

Since the value that a given typed literal denotes is defined by the typed literal's datatype, and, with the exception of rdf:XMLLiteral, RDF does not define…

Rdf Primer #RDF #datatypes #software #RDF-graphs #graph

One ontology to rule them all

To my knowledge, nobody has ever claimed that there should be “one ontology to rule them all.” Instead, what is regularly promoted is ontology reuse and/or…

Two Misconceptions About The Semantic Web #ontology #Web #RDF-data #World-Wide-Web

Triples all the way down

RDF is meant to solve the problem of meaningfully publishing data (not just documents) on the World Wide Web. Beyond that, do what you want. More…

Two Misconceptions About The Semantic Web #World-Wide-Web #Wide-Web #RDF-data #explicit-semantics #use-cases #Web

Why RDF rather than XML

The answer to "why use RDF rather than XML?" is quite simple, and is twofold. Firstly, the benefit that one gets from drafting a language in RDF is that the…

The Semantic Web: An Introduction #RDF #Web #bits #RDF-data #Semantic-Web