Skip to content

Method: Rdf4jOntoDriverProperties()

1: /*
2: * JOPA
3: * Copyright (C) 2024 Czech Technical University in Prague
4: *
5: * This library is free software; you can redistribute it and/or
6: * modify it under the terms of the GNU Lesser General Public
7: * License as published by the Free Software Foundation; either
8: * version 3.0 of the License, or (at your option) any later version.
9: *
10: * This library is distributed in the hope that it will be useful,
11: * but WITHOUT ANY WARRANTY; without even the implied warranty of
12: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13: * Lesser General Public License for more details.
14: *
15: * You should have received a copy of the GNU Lesser General Public
16: * License along with this library.
17: */
18: package cz.cvut.kbss.ontodriver.rdf4j.config;
19:
20: public abstract class Rdf4jOntoDriverProperties {
21:
22: /**
23: * Specifies whether a in-memory storage should be used for local RDF4J repositories.
24: * <p>
25: * When set to true, any local RDF4J repositories that are created by the driver are created as only MemoryStores
26: * without any persistent backend. Repositories accessed over the Internet or already existing locally are not
27: * affected by this setting.
28: * <p>
29: * {@code Boolean} value expected, default is false.
30: */
31: public static final String USE_VOLATILE_STORAGE = "cz.cvut.kbss.ontodriver.rdf4j.use-volatile-storage";
32:
33: /**
34: * Specifies whether RDF4J inference (RDFS, forward chaining) should be used.
35: * <p>
36: * Note that this setting applies only to local storages (in memory or native), remote storages use their own
37: * inference settings.
38: * <p>
39: * {@code Boolean} value expected, default is false.
40: */
41: public static final String USE_INFERENCE = "cz.cvut.kbss.ontodriver.rdf4j.use-inference";
42:
43: /**
44: * Specifies how many requested assertions suffice to perform load all.
45: * <p>
46: * More specifically, if the number of assertions requested by an {@link cz.cvut.kbss.ontodriver.descriptor.AxiomDescriptor}
47: * is low enough, the statements for them will be loaded by asking RDF4J for statements with subject and property
48: * bound.
49: * <p>
50: * Otherwise, statements will be loaded using only subject bound and will be filtered according to the assertions.
51: * This will in most cases have better performance than loading with bound property.
52: */
53: public static final String LOAD_ALL_THRESHOLD = "cz.cvut.kbss.ontodriver.rdf4j.load-all-threshold";
54:
55: /**
56: * Path to repository configuration file.
57: * <p>
58: * The configuration file is a Turtle file corresponding to the repository config file schema defined by RDF4J. See
59: * for example <a href="http://docs.rdf4j.org/server-workbench-console/#_repository_configuration_templates_advanced">
60: * http://docs.rdf4j.org/server-workbench-console/#_repository_configuration_templates_advanced</a>
61: * <p>
62: * Sample configuration files are available in the RDF4J GitHub repo:
63: * <a href="https://github.com/eclipse/rdf4j/tree/master/repository/api/src/main/resources/org/eclipse/rdf4j/repository/config">
64: * https://github.com/eclipse/rdf4j/tree/master/repository/api/src/main/resources/org/eclipse/rdf4j/repository/config</a>
65: * <p>
66: * The config file can be present on the classpath (if the value starts with the {@code classpath:} prefix) or can
67: * be loaded using the value as file path. The loaded configuration supersedes relevant properties passed to the
68: * driver, e.g., {@link #USE_VOLATILE_STORAGE} or {@link #USE_INFERENCE}.
69: * <p>
70: * Note that the config applies only to embedded repositories created by the driver, repositories on a RDF4J server
71: * to which the driver just connects must preexist and the configuration does not apply to them. The physical URI
72: * specified in configuration must correspond to the URI of the repository in the config file, i.e., for memory
73: * store, the repository ID must be the same. For a native store, the physical URI must be in the form {@code
74: * /local-path/repositories/repository-id}, where {@code local-path} will be used for initialization of a local
75: * {@link org.eclipse.rdf4j.repository.manager.RepositoryManager} and {@code repository-id} must again correspond to
76: * the repository ID in the configuration file.
77: */
78: public static final String REPOSITORY_CONFIG = "cz.cvut.kbss.ontodriver.rdf4j.repository-config";
79:
80: /**
81: * Number of attempts to reconnect to the repository in case of connection issues.
82: * <p>
83: * This setting applies only when using a remote rdf4j-server repository (including GraphDB). Applies also when
84: * initial connection on startup is attempted.
85: * <p>
86: * Note that once connection is successful, the counter of failed attempts is reset.
87: */
88: public static final String RECONNECT_ATTEMPTS = "cz.cvut.kbss.ontodriver.rdf4j.reconnect-attempts";
89:
90: /**
91: * Whether inferred assertion values are expected to exist in the default repository context.
92: * <p>
93: * Normally, RDF4J stores inferred statements in the context of the statement from which they were inferred.
94: * However, if one uses SPIN rules or custom inference rules
95: * <a href="https://rdf4j.org/documentation/programming/repository/#custom-inferencing">https://rdf4j.org/documentation/programming/repository/#custom-inferencing</a>,
96: * their results will be stored in the default context. Setting this parameter to {@code true} will cause the
97: * statement loading to use the default context for loading inferred assertions.
98: * <p>
99: * Note that GraphDB inference is handled automatically and does not need this parameter. However, setting it will
100: * override the default automatic inference context resolution for GraphDB.
101: * <p>
102: * Defaults to {@code false}, i.e., inferred statements are expected in the same context as their causes.
103: */
104: public static final String INFERENCE_IN_DEFAULT_CONTEXT = "cz.cvut.kbss.ontodriver.rdf4j.inference-in-default-context";
105:
106: /**
107: * Timeout for the underlying HTTP client to request a connection to the remote repository from the connection
108: * pool.
109: * <p>
110: * RDF4J internally uses the Apache HTTP Client with a connection pool that is able to grow up to a configured
111: * limit. When the pool is exhausted and the driver requests another connection, it may happen that no connection is
112: * available will become available, possibly leading to a deadlock. This parameter sets a timeout for the connection
113: * acquisition requests from the pool, so that the application is able to fail gracefully in case of too much load
114: * and does not get stuck.
115: * <p>
116: * The value should be an integer corresponding to the number of milliseconds.
117: * <p>
118: * Applies only to instances connected to a RDF4J server.
119: */
120: public static final String CONNECTION_REQUEST_TIMEOUT = "cz.cvut.kbss.ontodriver.rdf4j.connection-request-timeout";
121:
122: /**
123: * Maximum size of the underlying HTTP client connection pool.
124: * <p>
125: * RDF4J internally uses the Apache HTTP Client with a connection pool that is able to grow up to a configured
126: * limit. This parameter allows to set this limit.
127: */
128: public static final String MAX_CONNECTION_POOL_SIZE = "cz.cvut.kbss.ontodriver.rdf4j.max-connections";
129:
130: /**
131: * RDF4J transaction isolation level.
132: *
133: * See {@link org.eclipse.rdf4j.common.transaction.IsolationLevels} for acceptable values.
134: */
135: public static final String TRANSACTION_ISOLATION_LEVEL = "cz.cvut.kbss.ontodriver.rdf4j.transaction-isolation";
136:
137: private Rdf4jOntoDriverProperties() {
138: throw new AssertionError();
139: }
140: }