Link Search Menu Expand Document
Start for Free

Virtual Graph Configuration

This page describes virtual graph configuration in detail.

Page Contents
  1. Overview
  2. Virtual Graph Properties
    1. JDBC Properties
      1. Tomcat Connection Pool Properties
      2. Passing Options Directly to the JDBC Driver
    2. CSV Properties
    3. MongoDB Properties
    4. Elasticsearch Properties
    5. Cassandra Properties
    6. SPARQL Engine/Service

Overview

As discussed in the How Virtual Graphs Work section, a virtual graph properties file is one of the three components that make up a Virtual Graph (the others being a unique name and mapping file). A virtual graph properties file must be in the Java properties file format.

We showed a minimal example (dept.properties) of a virtual graph properties file to connect to a MySQL database:

jdbc.url=jdbc:mysql://localhost/dept
jdbc.username=MySqlUserName
jdbc.password=MyPassword
jdbc.driver=com.mysql.jdbc.Driver

Recall, the name of the properties file without the extension (dept in the example used), will become the unique name of the virtual graph.

Below you’ll see all available virtual graph properties in addition to connection pool properties for the built-in Tomcat connection pool that can be modified. All of these properties should go inside the virtual graph properties file like the one shown above.

Virtual Graph Properties

The following tables list the available options for use in virtual graph properties files.

jdbc. properties are used for all relational data sources.

The following properties apply to all virtual graphs.

base

Default  
Description Base IRI used to resolve relative IRIs from virtual graphs.

percent.encode

Default true
Description Should IRI template strings be percent-encoded to be valid IRIs? (true/false)

import.optimize

Default true
Description Should virtual import and ?s ?p ?o queries use the optimized translation? (true/false)

parser.sql.quoting

Default false
Description If unspecified, R2RML views (using rr:sqlQuery) will be parsed using the DB-native identifier quoting convention. For example, MySQL queries will be parsed treating backtick as the identifier quote character. If set to ANSI, the ANSI SQL convention of treating a double quote as the identifier quote character will be used instead.

sql.functions

Default  
Description A comma-separated list of SQL function names to register with the parser. If an R2RML view (using rr:sqlQuery) fails to parse, this option can be set to allow use of non-standard functions.

unique.key.sets

Default  
Description For data sources that do not express unique constraints in their metadata, either because unique constraints are not supported or because the data source did not include some or all of the valid constraints for reasons such as performance concerns, this property is used to define additional constraints manually. The property value is a comma-separated list of keys that define unique rows in a table. Each key is itself a comma-separated list of schema-qualified columns, enclosed in parentheses. For example, if table APP.CUSTOMERS has an ID column that serves as a primary key and a pair of columns, FNAME and LNAME, that together are a unique key, the value to express that is: (APP.CUSTOMERS.ID),(APP.CUSTOMERS.FNAME,APP.CUSTOMERS.LNAME)

default.mapping.include.tables

Default  
Description A comma-separated list of tables to include when generating default mappings. If blank, mappings will be generated for all tables in the default schema for the connected user, plus any schemas listed in sql.schemas. Cannot be combined with default.mapping.exclude.tables.

default.mapping.exclude.tables

Default  
Description A comma-separated list of tables to exclude when generating default mappings. Mappings will be generated for all tables in the default schema for the connected user, plus any schemas listed in sql.schemas, except those tables listed in this option. Cannot be combined with default.mapping.include.tables.

schema.in.generated.mappings

Default false (true for Elasticsearch)
Description Whether to include the name of the schema (along with the table name) in the templates for IRIs when automatically generating mappings based on source database metadata. For Elasticsearch, setting this to true will cause the index name to be included in the template.

JDBC Properties

jdbc.url

Default  
Description The URL of the JDBC connection.

jdbc.username

Default  
Description The username used to make the JDBC connection.

jdbc.password

Default  
Description The password used to make the JDBC connection.

jdbc.driver

Default  
Description The driver class name used to make the JDBC connection.

sql.dialect

Default Inferred from supported JDBC drivers. ORACLE for unsupported drivers.
Description When using an unsupported JDBC driver, this option can be used to specify the format of the generated SQL. The options supported are ATHENA, CASSANDRA, DB2, DERBY, ELASTICSEARCH, EXASOL, H2, HANA, HIVE, IMPALA, MSSQL, MYSQL, ORACLE, POSTGRESQL, REDSHIFT, SYBASE, TERADATA

sql.schemas

Default  
Description A comma-separated list of schemas to append to the schema search path. This option allows R2RML tables and queries to reference tables that are outside of the default schema for the connected user.

sql.default.schema

Default  
Description Override the default schema for the connected user. Tables in the default schema may be referenced without qualification (mytable or "mytable" rather than myschema.mytable or "myschema"."mytable").

Tomcat Connection Pool Properties

Additionally, connection pool properties for the built-in Tomcat connection pool are allowed. This set of additional allowed properties is listed in the Tomcat JDBC Connection Pool documentation. Stardog sets these connection pool defaults:

initialSize=3
testWhileIdle=true

# 4 hours
timeBetweenEvictionRunsMillis=14400000

validationQueryTimeout=10

To disable connection pooling, one can set the following connection pool properties

testOnBorrow=true
timeBetweenEvictionRunsMillis=0
maxIdle=0
minIdle=0

This may be uesful for troubleshooting some configurations.

Passing Options Directly to the JDBC Driver

Any options with the prefix ext. will be passed directly to the JDBC Driver. Tomcat connection pool properties do not need to be prefixed with ext.

Any unknown options will be ignored.


CSV Properties

csv.separator

Default ,
Description A single-character separator used when importing tabular data files.

csv.quote

Default  
Description A single character used to encapsulate values containing special characters.

csv.escape

Default  
Description A single character used to escape values containing special characters.

csv.header

Default true
Description Should the import process read the header row? When headers are enabled the first row of the input file is used to retrieve the column names and mappings can refer to those column names. (true/false)

csv.skip.empty

Default true
Description Should empty values be skipped in the CSV file? If true no triples will be generated for templates that refer to a column with empty value. (true/false)

csv.class

Default  
Description Which class should be imported rows from CSV files be members of?

csv.hash.function

Default SHA1
Description Which hash function should be when the # notation is used to import CSV files? Any hash function supported by Stardog is allowed here, SHA1, SHA256, SHA384, SHA512, MURMUR3, XX, MD5.

MongoDB Properties

mongodb.uri

Default  
Description The URI for the MongoDB connection. Examples: mongodb://localhost/mydb or mongodb+srv://myUserName:myP4ssw0rd@cluster0-kgprod.company.com/mydb

Elasticsearch Properties

elasticsearch.rest.urls

Default  
Description Whitespace-delimited list of connection host/port values for Elasticsearch. Example: server1:9200 server2:9200 server3:9200

elasticsearch.username

Default  
Description Username for Elasticsearch connections

elasticsearch.password

Default  
Description Password for Elasticsearch connections

Cassandra Properties

cassandra.contact.point

Default  
Description The address of the Cassandra node(s) that the driver uses to discover the cluster topology. Example: cassandra.abc.com

cassandra.keyspace

Default  
Description The Cassandra keyspace to use for this session

cassandra.username

Default  
Description The username for the Cassandra cluster

cassandra.password

Default  
Description The password for the Cassandra cluster

cassandra.allow.filtering

Default false
Description Whether to include the ALLOW FILTERING clause at the end of Cassandra CQL queries. Not recommended for production use.

SPARQL Engine/Service

sparql.url

Default  
Description SPARQL query endpoint/connection string with database specified, i.e. http://myhost:26023/testdb/query

sparql.username

Default  
Description The username to access the SPARQL endpoint.

sparql.password

Default  
Description The password to access the SPARQL endpoint.

sparql.graphname

Default  
Description The graph name on SPARQL endpoint that needs to be mapped as virtual graph.

sparql.statsbasedoptimization

Default true
Description The boolean value to enable/disable statistics based optimization while accessing SPARQL endpoint. By default its always enabled.