# Standards compliance

# SPARQL 1.1

Updated for 5.1.0.

In the following table we present a summary of the compliance of the latest version of Ontop with SPARQL 1.1 (opens new window), where rows correspond to sections of the W3C recommendation and unsupported features are crossed out. Most of the features are supported, but some are unsupported or only partially supported.

Section in
SPARQL 1.1
Features Coverage
5. Graph Patterns (opens new window) BGP, FILTER 2/2
6. Including Optional Values (opens new window) OPTIONAL 1/1
7. Matching Alternatives (opens new window) UNION 1/1
8. Negation (opens new window) MINUS, FILTER [NOT] EXISTS 1/2
9. Property Paths (opens new window) PredicatePath, InversePath, ZeroOrMorePath, ... 0
10. Assignment (opens new window) BIND, VALUES 2/2
11. Aggregates (opens new window) COUNT, SUM, MIN, MAX, AVG, GROUP_CONCAT, SAMPLE 6/6
12. Subqueries (opens new window) Subqueries 1/1
13. RDF Dataset (opens new window) GRAPH, FROM [NAMED] 2/2
14. Basic Federated Query (opens new window) SERVICE 0
15. Solution Seqs. & Mods. (opens new window) ORDER BY, SELECT, DISTINCT, REDUCED, OFFSET, LIMIT 6/6
16. Query Forms (opens new window) SELECT, CONSTRUCT, ASK, DESCRIBE 4/4
17.4.1. Functional Forms (opens new window) BOUND, IF, COALESCE, EXISTS, NOT EXISTS, || , &&, =, sameTerm, IN, NOT IN 9/11
17.4.2. Functions on RDF Terms (opens new window) isIRI, isBlank, isLiteral, isNumeric, str, lang, datatype, IRI, BNODE, STRDT, STRLANG, UUID, STRUUID 11/13
17.4.3. Functions on Strings (opens new window) STRLEN, SUBSTR, UCASE, LCASE, STRSTARTS, STRENDS, CONTAINS, STRBEFORE, STRAFTER, ENCODE_FOR_URI, CONCAT, langMatches, REGEX, REPLACE 14/14
17.4.4. Functions on Numerics (opens new window) abs, round, ceil, floor, RAND 5/5
17.4.5. Functions on Dates&Times (opens new window) now, year, month, day, hours, minutes, seconds, timezone, tz 8/9
17.4.6. Hash Functions (opens new window) MD5, SHA1, SHA256, SHA384, SHA512 5/5
17.5 XPath Constructor Functions (opens new window) Casting -
17.6 Extensible Value Testing (opens new window) user defined functions 0

# Limitations

  • The 5 hash functions and functions REPLACE and REGEX for regular expressions have limited support because they heavily depend on the DBMS: not all DBMSs provide all hash functions, and many DBMSs have their own regex dialects. Currently, the SPARQL regular expressions of REPLACE and REGEX are simply sent to the DBMS by default.
  • In the implementation of function langMatches, the second argument has to a be a constant: allowing variables will have a negative impact on the performance in our framework.

# GeoSPARQL 1.0

Starting from 4.1.0.

The following table provides a summary of the compliance of the latest version of Ontop with OGC GeoSPARQL 1.0 (opens new window), the standard for representing and querying geospatial linked data. The summary focuses only on the main geospatial functions and properties and unsupported features are crossed out.

Section in OGC GeoSPARQL 1.0
Features Coverage
7. Topology Vocabulary Extensions - Properties geo:sfEquals, geo:sfDisjoint, geo:sfIntersects, geo:sfTouches, geo:sfCrosses, geo:sfWithin, geo:sfContains, geo:sfOverlaps, geo:ehEquals, geo:ehDisjoint, geo:ehMeet, geo:ehOverlap, geo:ehCovers, geo:ehCoveredBy, geo:ehInside, geo:ehContains, geo:rcc8eq, geo:rcc8dc, geo:rcc8ec, geo:rcc8po, geo:rcc8tppi, geo:rcc8tpp, geo:rcc8ntpp, geo:rcc8ntppi 0
8.4. Standard Properties for Geo:Geometry geo:dimension, geo:coordinateDimension, geo:spatialDimension, geo:isEmpty, geo:isSimple, geo:hasSerialization 0
8.5. WKT Serialization geo:wktLiteral, geo:asWKT 2/2
8.6. GML Serialization geo:gmlLiteral, geo:asGML 0
8.7. Non-Topological Query Functions geof:distance, geof:buffer, geof:convexHull , geof:intersection, geof:union, geof:difference geof:symDifference, geof:envelope, geof:boundary, geof:getSRID, 10/10
9.2. Common Query Functions geof:relate 1/1
9.3. Topological Simple Features Relation Family Query Functions geof:sfEquals, geof:sfDisjoint, geof:sfIntersects, geof:sfTouches, geof:sfCrosses, geof:sfWithin, geof:sfContains, geof:sfOverlaps 8/8
9.4. Topological Egenhofer Relation Family Query Functions geof:ehEquals, geof:ehDisjoint, geof:ehMeet, geof:ehOverlap, geof:ehCovers, geof:ehCoveredBy, geof:ehInside, geof:ehContains 8/8
9.5. Topological RCC8 Relation Family Query Functions geof:rcc8eq, geof:rcc8dc, geof:rcc8ec, geof:rcc8po, geof:rcc8tppi, geof:rcc8tpp, geof:rcc8ntpp, geof:rcc8ntppi 8/8

Several non-topological query functions use a unit of measure URI which OGC defines under a specific namespace e.g. <http://www.opengis.net/def/uom/OGC/1.0/metre>. The latest version of Ontop currently supports the units metre, radian and degree.

# R2RML

Updated for 4.2.0

The latest version of Ontop is almost fully compliant with the R2RML (opens new window) standard.

At the moment, it does NOT support:

For complex SQL queries (e.g. with a GROUP BY) in the mapping, Ontop may not be able to infer the datatype of each column if the option ontop.allowRetrievingBlackBoxViewMetadataFromDB is not enabled (disabled by default). In such a situation, it may not be able to derive the natural RDF datatype (opens new window) of a literal built over a column and may not apply the expected normalization. This can be partially mitigated by expliciting the RDF datatype in the mapping, but normalization would remain unapplied.

# RDF 1.1

Ontop complies with RDF 1.1 (opens new window). It types simple literals (from RDF 1.0) as xsd:string and literals with a language tag as rdf:langString.

# OWL 2 QL

# RDFS

# Time functions

Updated for 5.1.0.

The functions using the prefix ofn (http://www.ontotext.com/sparql/functions/) and their documentation can be found here (opens new window). They accept both xsd:date and xsd:dateTime as arguments. (supported since 4.2.0).

The functions using the prefix obdaf (https://w3id.org/obda/functions#) have been introduced in 5.1.0 (see #705 (opens new window)).

Function
Argument 1 Argument 2
ofn:weeksBetween xsd:date xsd:date
ofn:weeksBetween xsd:dateTime xsd:dateTime
ofn:weeksBetween* xsd:date xsd:dateTime
ofn:weeksBetween* xsd:dateTime xsd:date
ofn:daysBetween xsd:date xsd:date
ofn:daysBetween xsd:dateTime xsd:dateTime
ofn:daysBetween* xsd:date xsd:dateTime
ofn:daysBetween* xsd:dateTime xsd:date
ofn:hoursBetween xsd:dateTime xsd:dateTime
ofn:minutesBetween xsd:dateTime xsd:dateTime
ofn:secondsBetween xsd:dateTime xsd:dateTime
ofn:millisBetween xsd:dateTime xsd:dateTime
obdaf:dateTrunc xsd:dateTime xsd:string
obdaf:milliseconds-from-dateTime xsd:dateTime
obdaf:microseconds-from-dateTime xsd:dateTime
obdaf:week-from-dateTime xsd:dateTime
obdaf:quarter-from-dateTime xsd:dateTime
obdaf:decade-from-dateTime xsd:dateTime
obdaf:century-from-dateTime xsd:dateTime
obdaf:millenium-from-dateTime xsd:dateTime

Combinations of argument datatypes marked with the symbol * are not supported for queries over the following data sources: Oracle and Microsoft SQL Server.

The obdaf:[datePart]-from-dateTime functions are supported for all dialects. They can be used to extract a specific part of the provided dateTime value in a numeric format (xsd:decimal for milliseconds and microseconds, xsd:integer for the remaining functions).

NOTE

The function obdaf:week-from-dateTime returns the ISO week index of the given date, where week 1 is considered the first week with a majority of its days in January.

The obdaf:dateTrunc function can be used to truncate a given xsd:dateTime to a new value with specified granularity. The granularity must be provided as an xsd:string literal. The following granularity values are supported:

  • microsecond
  • millisecond
  • second
  • minute
  • hour
  • day
  • week
  • month
  • quarter
  • year
  • decade
  • century
  • millennium

WARNING

Not all database systems support all granularities equally.

decade, century, and millennium are not supported by:

  • AWS Athena
  • Denodo (century is supported)
  • MySQL (century is supported)
  • MariaDB (century is supported)
  • Oracle
  • Presto
  • SQLServer
  • Snowflake
  • Spark
  • Trino

second is not supported by:

  • Denodo

millisecond and microsecond are not supported by:

  • AWS Athena
  • Denodo
  • MySQL
  • MariaDB
  • Oracle
  • Presto
  • Trino

PostgreSQL requires these granularities to be named milliseconds and microseconds instead.

# Examples

obdaf:year("2023-08-16T09:00:00"^^xsd:dateTime) "2023"^^xsd:integer

obdaf:hour("2023-08-16T09:00:00"^^xsd:dateTime) "9"^^xsd:integer

obdaf:dateTrunc("2023-08-16T09:00:00"^^xsd:dateTime, "month"^^xsd:string) "2023-08-01T00:00:00"^^xsd:dateTime