analyzeStorage
| • | This command can be used to update the statistics of the OntoBroker storage. Recommended to execute after large updates when H2 storage is used. |
| • | Example: _ontobrokerManager.executeCommand("analyzeStorage") |
Result: "Storage analyzed in 42 ms.W
busy
| • | Returns the server status. |
| • | syntax: busy |
| • | OntoBroker Return Values: true, false |
| • | client-side output: "[INFO]: Server busy state: [true|false]" |
clear
| • | All stored answers in the cache are removed |
| • | syntax: clear |
| • | OntoBroker Return Values: cache cleared |
commands
| • | Returns a list of all available commands in the server |
| • | syntax: commands |
| • | OntoBroker Return Values: A list with all server commands |
delete
The command del has been removed since Ontobroker 6.0. Instead, please use the delete command which has a richer syntax.
Here is an example of how to use delete instead of del.
Old syntax in OntoBroker 5.3
del otto[age->18]. // syntax from OB 5.3, invalid in OntoBroker 6.1
In OntoBroker 6.1 the corresponding command is
delete otto[name->"Otto"].
The delete command is used to remove facts and rules from an ontology. Its syntax is very similar to the insert syntax.
Example with single fact:
:- module <http://yourcompany.com/ontology1>.
delete Person[name *=> _string].
Example with multiple facts and rules:
:- module <http://yourcompany.com/ontology1>.
delete {
Person[name *=> _string, age {0:1} *=> _integer].
otto:Person[name -> "Otto Waalkers"].
fritz[name -> "Fritz", age->9].
@{rule1} ?X:Child :- ?X:Person, ?X.age < 18 .
}
Example with where clause:
delete {p(?X,?Y),q(?X),q(?Y).} where {@{options[inferOff]} ?- p(?Y,?X).}
Also note that it is allowed to specify query options (since OB 6.0 Build 382)
delete clauses
This command can be used to delete clauses (rules, queries, constraints) by their label.
For example to delete the rule with the id r1 and the query with the id q1:
delete clauses r1,q1
dump
Writes a full dump of the extensional and the intensional database (internal representation). The target folder is the so called dump folder where OntoBroker is installed.
exportAllModules
Writes a dump of all modules to the files system. The target folder is the folder where OntoBroker is installed.
The command "exportAllModules" supports additional options:
| • | encrypt - modules are saved encrypted |
| • | sort - facts of modules are saved in sorted order |
NOTE: If, in the command line, you specify a directory to load the ontologies from like "ontobroker -obl decrypt:v1:dir", the decrypt handler first of all checks if the file is encrypted. Example: ontobroker -obl decrypt:v1:C:\ontologies
Example
Save modules <http://yourcompany.com#ontology1> to file c:\data\onto1.obl with sorted option
save <http://yourcompany.com#ontology1> to "c:\\data\\onto1.obl",sort.
Save modules <http://yourcompany.com#ontology1> to file c:\data\onto1.obl with sort and encrypt option
save <http://yourcompany.com#ontology1> to "c:\\data\\onto1.obl",sort,encrypt.
Export all modules sorted
exportAllModules sort.
Export all modules sorted and encrypted
exportAllModules sort,encrypt.
NOTE: If "SerializerEscapeNewLines = on" is set in the OntoConfig.prp, new line characters in string constants are escaped on serialization (i.e. on commands like "exportAllModules" and "save")
This switch can be set in OntoConfig.prp via:
<SerializerEscapeNewLines> = <on|off>
generateDynamicSvc
There are now two commands for dynamic web services:
generateDynamicSvc "path-to-specification-module.obl".
The string argument must be a valid URL or path to the specification module file.
and
deleteDynamicSvc <module>
Here <module> is the module term of the specification module.
NOTE: OntoBroker must have been started with the "-webservice" option. The command is only available for Objectlogic
Example
:- module echo.
:- prefix in = "http://schema.ontoprise.com/dynamic-svc/in#".
:- prefix out = "http://schema.ontoprise.com/dynamic-svc/out#".
:- prefix meta = "http://schema.ontoprise.com/dynamic-svc/meta#".
// Spec for Input
in#Parameters[in#message {1:1} *=> _string].
// Spec for Output
out#Results[out#echo {0:1} *=> _string].
// Generation of Output
theResults:out#Results.
theResults[out#echo -> ?X] :- ?P:in#Parameters[in#message->?X].
h2 backup <output-name>
| • | Example: h2backup "d:\\backup\\mybackup.data.db" |
| • | The single argument specifies the target filename of the database copy. |
| • | This backups the database file to "d:\\backup\\mybackup.data.db". |
Caution – All files like "d:\\backup\\mybackup.*" are deleted during the copy action to prevent the possible mixing of old and new temporary database files.
| • | Restoring a backup requires the following steps: |
| 1. | Shutdown OntoBroker |
| 2. | Delete all H2 database files, e.g. if the database is named "edb", you have to delete "edb.*". |
| 3. | Copy the backup file to the old location and rename it to the original name. E.g if the database is named "edb", then the database file must be named "edb.data.db". |
| 4. | Start OntoBroker. On opening the database file, the indices will be reconstructed. This procedure may take some time (typically a few minutes/GB). |
NOTE: The command "h2backup" is only available if OntoBroker is running with H2 as storage.
info
| • | This command checks some properties about the rules and facts and returns a (multiline) info message about the extensional database (EDB, the facts) and the intensional database (IDB, the rules). The output is similar to the output of the "ontology checker" commandline tool. |
| • | syntax: info |
Example output
------------------------------------------------------
IDB
------------------------------------------------------
[ ] program contains aggregation cycles (not allowed)
[ ] program is not bottomup evaluable (could be bad for performance)
[ ] program is not stratified and must be evaluated in wellfounded mode (bad for performance)
[ ] program contains rules with cross products (bad for performance)
[ ] program contains rules which apply aggregations incorrectly (not allowed)
# user rules: 0
# internal rules (including standard axioms): 48
# rules with negations: 3
# rules with aggregations: 0
# rules with connectors: 0
# rules with other builtins: 4
------------------------------------------------------
EDB: RAM.Packed (RAM.Packed)
# of tables: 1
------------------------------------------------------
1 tuples in obl:intern:module/1
...
insert
The command <add> has been removed since Ontobroker 6.0. Please use the insert command which has a richer syntax instead. Here are some examples of how to use insert instead of add.
Old syntax in OntoBroker 5.3:
add otto[name->"Otto"]. // syntax from OB 5.3, invalid in OntoBroker 6.1
add RULE r1: FORALL X p(X) <- q(X). // syntax from OB 5.3, invalid in OntoBroker 6.1
In OntoBroker 6.1 the corresponding commands are:
insert otto[name->"Otto"].
insert {@{r1} p(?X) :- q(?X).}
The insert command is used to add facts and rules to an ontology. You can add multiple facts or rules with a single command if you use braces {...} around them.
Example with single fact:
:- module <http://yourcompany.com/ontology1>.
insert Person[name *=> _string].
Example with multiple facts and rules:
:- module <http://yourcompany.com/ontology1>.
insert {
Person[name *=> _string, age {0:1} *=> _integer].
otto:Person[name -> "Otto Waalkers"].
fritz[name -> "Fritz", age->9].
@{rule1} ?X:Child :- ?X:Person, ?X.age < 18 .
}
Note that you can add directives for the module and namespace alias as an header to the command.
You can also generate additional facts by inferencing if you add a where part to the insert statement. In this case, all variable bindings resulting from the query of the where part are replaced in the insert part.
Simple example:
:- module <http://yourcompany.com/ontology1>.
insert { ?X[lovesToys->true]. } where { ?- ?X:Child. }
Assuming that the results of the query ?- ?X:Child are fritz and susan, this example would insert the facts fritz[lovesToys->true] and susan[lovesToys->true].
isalive
| • | Checks whether the server is up and running |
| • | syntax: isalive |
| • | OntoBroker Return Values: Inference Server on port 2267 is up and running ... |
kill
| • | Kills the server. Behaves like shutdown now, but ends the OntoBroker process after 70 seconds if "shutdown now" was not successful within this time. Also see the shutdown command for alternative behavior. |
| • | syntax: kill |
| • | OntoBroker Return Values: inference server shutting down NOW ... |
modify
With the modify command you can add and remove facts in a single step. As the variable bindings of the where part are used for both insert and delete, this can be quite useful and is easily covered by separate delete and insert commands.
Example:
// increment the age of all age attributes for persons
modify delete { ?P[age->?AGE]. } insert { ?P[age->?NEWAGE]. } where { ?- ?P:Person[age->?AGE], ?NEWAGE=?AGE + 1 .}
query
| • | Sends a ObjectLogic query to the server and receives the answers |
| • | syntax: query [ObjectLogic query] |
| • | example: query "?- ?X:?Y@_defaultModule." |
| • | OntoBroker Return Values: - |
reload
| • | Causes the server to reload all files from the start-up |
| • | syntax: reload |
| • | OntoBroker Return Values: - |
removeExplanation
| • | Removes an explanation with the given name. If no explanation exists no error is reported. |
| • | syntax: removeExplanation <explanation module> |
| • | OntoBroker Return Values: Module prooftreefacts_(<module1>) deleted |
shutdown
| • | Shutdown without argument causes OntoBroker to process all outstanding queries and commands, but no new queries and commands are accepted anymore. The variant "shutdown NOW" causes OntoBroker to drop all waiting queries and commands and to stop all running queries and commands immediately in a controlled way. Also see the kill command. |
| • | syntax: shutdown [NOW] |
| • | OntoBroker Return Values: [INFO]: inference server shutting down ... |
stopQuery
| • | Sets an interrupt flag for the currently running query with the given querykey. The query will stop in a controlled way. The argument <querykey> identifies the query to stop. This value is returned immediately after starting a query command. |
| • | syntax: stopquery <querykey> |
| • | OntoBroker Return Values: "Interrupt flag set" or "No query found for querykey <querykey>" |
Check for OWL 2 RL profile
| • | This command checks if an OWL ontology is conformant with the OWL RL profile. |
| • | Syntax: checkOWLRLProfile <ontology-uri> |
| • | Each found violation of the OWL RL profile is listed as output. |
Connector cache clear command
| • | This command cleans a connector cache. This command can be executed only if Ontobroker is started with the option Connector.*.Cache.Lifetime = unlimited. |
| • | Syntax: clear_connector_cache all | cache key |
| • | all - all tuples will be deleted from the cache. |
| • | cache key - only tuples for the cache key will be deleted. Cache key is a map term and can contain different values for different connectors. |
saveSessionSnapshot
| • | This command saves all session facts and attributes to the given filename |
| • | To encrypt the session use: saveSessionSnapshot "filename", encrypt. |
| • | Syntax: saveSessionSnapshot "filename". |
loadSessionSnapshot
| • | This command loads all session facts and attributes from the given filename. |
| • | Syntax: loadSessionSnapshot "filename". |