DB2 Version 10.1 for Linux, UNIX, and Windows

SPARQL query support

There are various syntactic or semantic restrictions and limitations for SPARQL to consider when you work with RDF data.

Limits on lengths of URIs
The DB2® database stores URIs up to a length of 12000 characters. Only the first 2000 characters are used for comparison operations.

In DB2 Version 10.1 Fix Pack 2 and later fix packs, an RDF implementation of DB2 database can store URIs of any length. However, only the first 2000 characters are used for comparison operations.

Limits on lengths of literals
The DB2 database stores literals up to a length of 12000 characters. Only the first 2000 characters are used for comparison operations and other operations like STRSTARTS and STRENDS.

In DB2 Version 10.1 Fix Pack 2 and later fix packs, an RDF implementation of a DB2 database stores literals of any length. However, only the first 2000 characters are used for comparison operations, and other operations such as STRSTARTS and STRENDS.

Data type operator in a FILTER expression
When the DATATYPE SPARQL operator is used in a filter against a string constant, the expression always evaluates to false.
FILTER(datatype(xsd:boolean(?v)) = xsd:boolean)
To ensure that the filter statement evaluates properly, issue the expression as shown:
 FILTER(datatype((?v1) = datatype(?v2)) evaluates correctly.

In DB2 Version 10.1 Fix Pack 2 and later fix packs, support is extended for the SPARQL DATATYPE operator in a FILTER expression.

Constants in a FILTER expression
A filter expression, where both left and right side operands are boolean constants, returns an RdfStoreException, with error identifier DB255001E and SQL error code -104.
FILTER( (TRUE || FALSE) = ?v )
A workaround is not available.

In DB2 Version 10.1 Fix Pack 2 and later fix packs, support is extended for constants in a FILTER expression.

Unary minus in a FILTER expression
A filter expression with a unary minus on variables is not supported.
FILTER ( -?v = -10 ) 
The expression returns an RdfStoreException, with error identifier DB255001E and SQL error code -104.
DISTINCT * or REDUCED * operators in a SELECT expression
A select expression with the DISTINCT * or REDUCED * operators is not supported.
Select DISTINCT * WHERE ...
The expression returns an RdfStoreException, with error identifier DB255001E and SQL error code -104.

In DB2 Version 10.1 Fix Pack 2 and later fix packs, support is extended for DISTINCT * or REDUCED * operators in a SELECT expression.

Data type operator in a SELECT expression
When the datatype SPARQL operator is used in a select expression, the expressionreturns the internal integer representation for the type rather than the string definition.
select datatype(?v) WHERE { ?s dc:format ?v }
A workaround is not available.

In DB2 Version 10.1 Fix Pack 2 and later fix packs, support is extended for the SPARQL data type operator in a SELECT expression.

Dot escape sequence in regular expression
The dot escape sequence in regular expression pattern matches has limitations, where the expression does not properly match the dot character.
FILTER regex(?val, "example\\.com")
The preceding code sample does not match the string "example.com" as expected.
Double backslash escape sequence limitation
Escape sequences with double backslash in strings do not get interpreted correctly. A workaround is not available.
Cygwin and createrdfstoreandloader command (Windows)
When you issue the createrdfstoreandloader command by using Cygwin on Windows platforms, Cygwin hangs instead of displaying any errors or warning messages. Therefore, issue the createrdfstoreandloader command only on Linux or UNIX platforms. Then use the generated DB2 load files and SQL files to load to a DB2 server on the Windows platform.