diff options
Diffstat (limited to 'src/main/scala/rsacomb/RDFoxUtil.scala')
| -rw-r--r-- | src/main/scala/rsacomb/RDFoxUtil.scala | 42 |
1 files changed, 42 insertions, 0 deletions
diff --git a/src/main/scala/rsacomb/RDFoxUtil.scala b/src/main/scala/rsacomb/RDFoxUtil.scala new file mode 100644 index 0000000..96710c4 --- /dev/null +++ b/src/main/scala/rsacomb/RDFoxUtil.scala | |||
| @@ -0,0 +1,42 @@ | |||
| 1 | package rsacomb | ||
| 2 | |||
| 3 | /* Java imports */ | ||
| 4 | import java.util.HashMap | ||
| 5 | import tech.oxfordsemantic.jrdfox.client.{ | ||
| 6 | ConnectionFactory, | ||
| 7 | ServerConnection, | ||
| 8 | DataStoreConnection | ||
| 9 | } | ||
| 10 | |||
| 11 | object RDFoxUtil { | ||
| 12 | |||
| 13 | def openConnection( | ||
| 14 | dataStore: String | ||
| 15 | ): (ServerConnection, DataStoreConnection) = { | ||
| 16 | /* Create local server connection | ||
| 17 | */ | ||
| 18 | val serverUrl = "rdfox:local" | ||
| 19 | val role = "" | ||
| 20 | val password = "" | ||
| 21 | val server = | ||
| 22 | ConnectionFactory.newServerConnection(serverUrl, role, password) | ||
| 23 | |||
| 24 | /* Create datastore connection | ||
| 25 | */ | ||
| 26 | val parameters = new HashMap[String, String]() | ||
| 27 | //parameters.put("equality", "noUNA") | ||
| 28 | server.createDataStore(dataStore, "seq", parameters) | ||
| 29 | val data = server.newDataStoreConnection(dataStore) | ||
| 30 | |||
| 31 | (server, data) | ||
| 32 | } | ||
| 33 | |||
| 34 | def closeConnection( | ||
| 35 | server: ServerConnection, | ||
| 36 | data: DataStoreConnection | ||
| 37 | ): Unit = { | ||
| 38 | server.close(); | ||
| 39 | data.close(); | ||
| 40 | } | ||
| 41 | |||
| 42 | } // object RDFox | ||
