-
Notifications
You must be signed in to change notification settings - Fork 8
Configuration
The WoT Hive directory automatically builds a default configuration when is started for the first time. This configuration file can be manually modified or through the REST API of the directory. When the file is manually modified the service will read the new configuration when restarted instead, when configured through the REST API the configuration will be automatically changed in the service (with some exception that requires restarting the service, e.g., the port where the WoT Hive runs).
The default configuration file is the following:
{
"triplestore": {
"updateEnpoint": "http://localhost:3030/sparql",
"queryEnpoint": "http://localhost:3030/sparql",
"queryUsingGET": true
},
"service": {
"directoryURIBase": "https://oeg.fi.upm.es/wothive/",
"port": 9000,
"maxThreads": 200,
"minThreads": 2,
"timeOutMillis": 30000,
"eventsSize": 100,
"eventsFile": "./events.json"
},
"validation": {
"enableShaclValidation": true,
"enableJsonSchemaValidation": true,
"schemaFile": "./schema.json",
"shapesFile": "./shape.ttl"
}
}
As it can be observed the file is split in three sub-JSONs
- triplestore allows configuring the triplestore that the WoT Hive will use to store the Thing Descriptions
{
"queryEnpoint": "http://localhost:3030/sparql",
"updateEnpoint": "http://localhost:3030/sparql",
"queryUsingGET": true
}
Here three main parameters must be provided the queryEndpoint and updateEndpoint that are the URLs of the triplestore's SPARQL endpoint with which the directory will interact to store or to upload triples. Notice that these endpoints may change, for instance in a GraphDB with a repository named discovery running in localhost:7200 the endpoints would be http://127.0.0.1:7200/repositories/discovery for querying and http://127.0.0.1:7200/repositories/discovery/statements for updating. Finally the queryUsingGET specifies if the interaction with the SPARQL endpoint will be performed using GET requests or POST, depending on what the triplestore's SPARQL supports. Usually GET is always supported.
- service allows configuring several features of the WoT Hive service
{
"directoryURIBase": "https://oeg.fi.upm.es/wothive/",
"port": 9000,
"maxThreads": 200,
"minThreads": 2,
"timeOutMillis": 30000,
"eventsSize": 100,
"eventsFile": "./events.json"
}
The parameters that require restarting the service are port (where the service runs), maxThreads and minThreads (indicating the threads used by the service), and timeOutMillis (the maximum response time for the requests). The parameter directoryURIBase specifies the base URI that the service will use for translating the Thing Descriptions to RDF when required. Finally, eventsSize indicates the maximum number of events that the service will store. These events are stored using a queue, and thus, when the number of events exceeds the maximum the oldest events will be the ones been removed first. The eventsFile specifies where the events will be stored.
- validation allows configuring the kind of validations performed by the WoT Hive service before storing a Thing Description
{
"enableShaclValidation": true,
"enableJsonSchemaValidation": true,
"schemaFile": "./schema.json",
"shapesFile": "./shape.ttl"
}
The parameters enableShaclValidation and enableJsonSchemaValidation enable or disable the validation using SHACL shapes and/or JSON schema, respectively. The parameters shapesFile and schemaFile specifies where the SHACL shapes or the JSON schema are allocated.
In order to read the current triplestore configuration of the WoT Hive service a client must perform a GET
request to the /configuration/triplestore
endpoint of the WoT Hive service. As a result, JSON configuration of the triplestore will be output. For instance, for reading the default configuration:
{
"queryEnpoint": "http://localhost:3030/sparql",
"updateEnpoint": "http://localhost:3030/sparql",
"queryUsingGET": true
}
In order to write a new configuration a client must perform a POST
request to the /configuration/triplestore
endpoint the WoT Hive service, attaching to the body of the request a configuration JSON with the new fields of the triplestore. For instance, in the case of a GraphDB:
{
"queryEnpoint": "http://127.0.0.1:7200/repositories/discovery", # New query endpoint
"updateEnpoint": "http://127.0.0.1:7200/repositories/discovery/statements", # New update endpoint
"queryUsingGET": true
}
In order to read the current service configuration of the WoT Hive service a client must perform a GET
request to the /configuration/service
endpoint of the WoT Hive service. As a result, JSON configuration of the service will be output. For instance, for reading the default configuration:
{
"directoryURIBase": "https://oeg.fi.upm.es/wothive/",
"port": 9000,
"maxThreads": 200,
"minThreads": 2,
"timeOutMillis": 30000,
"eventsSize": 100,
"eventsFile": "./events.json"
}
In order to write a new configuration a client must perform a POST
request to the /configuration/service
endpoint the WoT Hive service, attaching to the body of the request a configuration JSON with the new fields of the service. For instance, in the case reducing the number of events to 50:
{
"directoryURIBase": "https://oeg.fi.upm.es/wothive/",
"port": 9000,
"maxThreads": 200,
"minThreads": 2,
"timeOutMillis": 30000,
"eventsSize": 50, # New events value
"eventsFile": "./events.json"
}
In order to read the current validation configuration of the WoT Hive service a client must perform a GET
request to the /configuration/validation
endpoint of the WoT Hive service. As a result, JSON configuration of the validation will be output. For instance, for reading the default configuration:
{
"enableShaclValidation": true,
"enableJsonSchemaValidation": true,
"schemaFile": "./schema.json",
"shapesFile": "./shape.ttl"
}
In order to write a new configuration a client must perform a POST
request to the /configuration/validation
endpoint the WoT Hive service, attaching to the body of the request a configuration JSON with the new fields of the validation. For instance, in the case of turning of the JSON Schema validation:
{
"enableShaclValidation": true,
"enableJsonSchemaValidation": false, # Validation with JSON Schema disabled
"schemaFile": "./schema.json",
"shapesFile": "./shape.ttl"
}
In order to read the current configuration of the WoT Hive service a client must perform a GET
request to the /configuration
endpoint of the WoT Hive service. As a result, the configuration JSON will be output. For instance, for reading the default configuration:
{
"triplestore": {
"updateEnpoint": "http://localhost:3030/sparql",
"queryEnpoint": "http://localhost:3030/sparql",
"queryUsingGET": true
},
"service": {
"directoryURIBase": "https://oeg.fi.upm.es/wothive/",
"port": 9000,
"maxThreads": 200,
"minThreads": 2,
"timeOutMillis": 30000,
"eventsSize": 100,
"eventsFile": "./events.json"
},
"validation": {
"enableShaclValidation": true,
"enableJsonSchemaValidation": true,
"schemaFile": "./schema.json",
"shapesFile": "./shape.ttl"
}
}
In order to write a new configuration a client must perform a POST
request to the /configuration
endpoint the WoT Hive service, attaching to the body of the request a full configuration JSON with the new fields. For instance, in the case of applying all the aforementioned changes of the previous sections:
{
"triplestore": {
"queryEnpoint": "http://127.0.0.1:7200/repositories/discovery", # New query endpoint
"updateEnpoint": "http://127.0.0.1:7200/repositories/discovery/statements", # New update endpoint
"queryUsingGET": true
},
"service": {
"directoryURIBase": "https://oeg.fi.upm.es/wothive/",
"port": 9000,
"maxThreads": 200,
"minThreads": 2,
"timeOutMillis": 30000,
"eventsSize": 50, # New events value
"eventsFile": "./events.json"
},
"validation": {
"enableShaclValidation": true,
"enableJsonSchemaValidation": false, # Validation with JSON Schema disabled
"schemaFile": "./schema.json",
"shapesFile": "./shape.ttl"
}
}
Notice that modifying the fields port, maxThreads, minThreads, and timeOutMillis requires restarting the service in order to be applied
WoT Hive was created by Andrea Cimmino ([email protected]) and Raúl García Castro ([email protected]) at the Universidad Politécnica de Madrid in the research group Ontology Engineering Group.