Size: 32789
Comment:
|
Size: 12172
Comment: Fausse manip
|
Deletions are marked like this. | Additions are marked like this. |
Line 3: | Line 3: |
= Interfacing with ORO = ORO provides an extended set of interfaces to ease its integration with other components. The main communication channel with ''oro-server'' is a simple socket interface. The protocole is very simple, and detailled below. However several bridges and wrapper have been developped for convenience. Two categories exist: bindings for specific languages and modules for some popular robotics middleware or integration framework. If needed, new ones could be easily added (you just need to be able to access sockets, and basically every language can do that). |
= Introducing ORO, the OpenRobots Ontology cognitive kernel = ''oro-server'' (or, in short, '''ORO''') is a Java-based knowledge base for cognitive robotic applications. It is developped at the LAAS-CNRS, France and IAS-Technische Universität München, Germany by Séverin Lemaignan ([[mailto:severin.lemaignan@laas.fr|severin.lemaignan@laas.fr]]) ''This page introduces the OpenRobots Ontology server ideas and features. The complete, up-to-date developers' documentation of oro-server can be found [[http://www.laas.fr/~slemaign/doc/oro-server/|here]]. Informations on this page are based on `oro-server 0.7.2`, as of February 2010.'' |
Line 17: | Line 17: |
== Raw sockets, debugging with Telnet == The underlying socket protocol is ASCII-based (ie, you can connect to the server with ''telnet'' to test everything). The examples, below, reproduce inputs on a Telnet session. === Requests === The general structure of a request to the server is: {{{ method_name ↵ [parameter1] ↵ [parameter2] ↵ [...] ↵ #end# ↵ }}} ''parameters'' can be either: * strings (quotes are not necessary, and are removed if present), * integers (strings made only of numbers), * floats (strings made of numbers with a dot somewhere), * booleans (strings equal to ''true'' or ''false'', case insensitive), * (ordered) lists or (unordered) sets of strings, with this structure: ''[val1, val2, ..., valn]''. If strings contain commas, they must be (single or doubled) quoted. * map of (key, value) pairs of strings, with this structure: ''{key1:val1, key2:val2, ...}''. If strings (be keys or values) contain commas, they must be (single or doubled) quoted. Please note that collections of collections are not supported.[[BR]][[BR]] === Responses === The server response has this structure if the request succeeded: {{{ ok [return_value] #end# }}} And this structure in case of failure: {{{ error [name of the exception, if available] [human-readable error message - that *may* spend over several lines] #end# }}} === Some examples === You can test this example by directly connecting to the server with a tool like ''telnet''. ==== Retrieving a human-friendly list of available methods on the server ==== {{{ > help }}} ==== Retrieving a machine-friendly list of available methods on the server ==== {{{ > listMethods > #end# }}} ==== Adding facts to the knowledge base ==== {{{ |
== What is ORO == === Introducing a cognitive layer === Robots interacting with complex, human-inhabited, environments are expected to exhibit advanced cognitive skills: objects recognition, natural language interactions, task planning with possible dynamic replanning, ability to cooperate with other robots or humans, etc. These functions, while being scientific challenges partially independent from each other, need to communicate, and thus ''to share a common representation of concepts of the world'', to be effectively combined in a complete, autonomous, robotic system. The `oro-server` project focuses precisely on the implementation of such a common description framework, along with a library of basic, reusable cognitive functions. This so-called '''cognitive kernel''' is actually build as a ''server'' that maps cognitive service to a ontology-based backend. Amongst other features, these base cognitive functions include: * Easy addition or removal of statements on the world (ie, truths for the robot's model): `add [aibo sees green_bottle]`, * Arbitrary complex queries, based on [[http://www.w3.org/TR/rdf-sparql-query/|SPARQL]]: `find robots [?robots sees ?object, ?object hasShape cylinder] [?robot hasWeight > 100]`, * Classification, rules application, first logic order reasonning on the set of statements, through the [[http://clarkparsia.com/pellet|Pellet]] library. * Possibility to assign to statements ''memory profiles'' that cause the robot to forget such facts after a predefinied amount of time, * Event system that triggers subscribed listeners, for instance when a fact becomes a true or a new object is discovered, * Categorization skills to find similarities or differences between concepts, * Explicit representation of other agents own world models (a bottle can be half full for the robot and half empty for another agent) ||<tablestyle="width:100%;text-align:center;" style="border:0px"> {{attachment:oro_architecture.png}}|| In practical terms, `oro-server` does mainly two things: * it registers and connects a set of services (presumably related to robotic cognition) to a socket interface, * it runs in the background several tasks to maintain the knowledge base. It relies on RDF/OWL ontologies to represent an store knowledge and runs several active processes that offer, amongst other things, reasonning facilities, support for bio-inspired memory models, concepts of "cognitive events", categorization and explicit modeling of other agents. Planned features include reinforcement learning, pro-active "curiosity" and mechanisms to handle cognitive conflicts (ie inconsistent chuncks of knowledge). === What can it be used for? === Upon these bricks, it possible to build semantic-aware layers and applications. At the system level, such a cognitive kernel allows: * to formally and explicitely '''represent the "knowledge" of the robot'''. The concepts present at any time in the cognitive kernel define the ''close'' set of what the robot can make sense of (noting that this set can of course grow and evolve during an experiment lifetime). * to '''check on real time the logical consistency''' of this knowledge, and to determine possible sources of inconsistencies, * it provides '''inference mechanisms''', such as inheritance of concept properties, * it offers a system-wide and exhaustive '''concept naming scheme''' that participates in overcoming the grounding issue by enabling heterogeneous components to share a common symbolic model, * it '''eases''' as well the process of matching and making sense of '''natural language interactions'''. First because the underlying backend ontology is rooted into human language (cf Wordnet, OpenCyc) and can associate human-intelligible labels to concept, then because it is possible to automatically retrieve synonyms (ie alternate labels) for the concepts known by the robot, which is useful to overcome expression difference when interacting with humans. ||<tablestyle="width:100%;text-align:center;" style="border:0px"> {{attachment:laas_example_semantic_scenarii.png}}|| At the application level, ORO enables to built semantic and context-aware components. Example of applications include: ''[LIST TO BE UPDATED]'' * link symbols to representation * semantic projection * spy game == Installation == === Via robotpkg === The supported way to install `oro-server` is through '''robotpkg''': Robotpkg is a package management system for robotics module we use at the LAAS. It handles dependencies and compilation automatically. If you don't know it, [[http://www.laas.fr/~mallet/robotpkg|have a look here]]. Once installed, you can add the `oro-server` package very easily: {{{ > cd $ROBOTPKG_BASE/knowledge/oro-server > make update }}} You're done! === From the sources === You can grab a snapshot of the sources on the public FTP: ftp://softs.laas.fr/pub/openrobots/oro-server/ Or, to get the latest version of `oro-server`, you can check-out the sources with GIT: {{{ > git clone http://softs.laas.fr/git/robots/oro-server.git }}} To run the ontology server, you'll need Java JRE >= 1.6. The two only dependencies of `oro-server` are on [[http://jena.sourceforge.net/|Jena]] >= 2.6.2 and [[http://clarkparsia.com/pellet|Pellet]] >=2.0. By default, the Makefile expect following paths for these library: {{{ $PREFIX/java/jena/lib $PREFIX/java/pellet/lib }}} You can override these defaults by setting the `$JENA_LIBS` and `$PELLET_LIBS` with your custom paths. You can then compile it with: {{{ > cd oro-server > make PREFIX=[your prefix] install > make PREFIX=[your prefix] install-doc }}} If everything went fine, a executable script called `oro-server` should have been created in `$PREFIX/bin`. Before starting the server, you can tune the options in `$PREFIX/etc/oro-server/oro.conf`. In particular, check the path to the ontology you want to load is correctly set up. If you don't have yet any ontology to play with, grab a [[http://www.laas.fr/~slemaign/oro/oro-20100112.tar.gz|fresh (January 2010) snapshot here]] or check the [[http://www.laas.fr/~slemaign/wiki/doku.php?id=openrobotsontology|OpenRobotsOntology]] page on my Wiki. == The OpenRobots Common Sense ontology == The knowledge that the robot acquires need to be somehow connected to other chunks of knowledge to become actually useful (enabling inference, contextualisation, efficient querying, etc.). This requires a common-denominator for the overall knowledge structure: users of the knowledge base must agree on common identifiers to symbolize identical concepts. This is provided by a "upper" ''common-sense'' ontology that can be loaded at the server startup. The common-sense ontology has its own page: '''[[oro-ontology.html|OpenRobots Common Sense ontology]]'''. == oro-server features == The server features the complete range of basic knowledge management (like adding, removing or querying facts. Check [[#index_of_available_methods| the list below]]). It supports as well a set of more advanced cognitive-related functions: === Alterite module === The "Alterité" (from French "otherness") module allows explicit representation of other agents with independant models of the world. === Categorization module === The "Categorization" module provides methods to extract similarities, differences and categories from a set of concepts. Several methods are offered, like `discriminate` that returns a list of properties that helps to differentiate individuals. For instance, let consider the following ontology, with four instances (plant1, animal1, animal2, animal3) : {{{ +-------+ | Thing | +--,'.--+ .-' `-. ,' `. ,' `-. .-' `. +----+--+ +--+-----+ | Plant | | Animal | +---+---+ +--+++---+ | _,-" | `--.._ | .-' | ``--.. plant1 animal1 animal2 animal3 | | / `. \ | | / `-. \ hasColor eats eats hasColor hasColor | | | | | | | | | | green banana grass blue red }}} If the robot wants to answer an ambigious order like ''Give me the thing!'', it needs a way to disambiguate the different possible individuals in the `Thing` class. The `discriminate` method would return the most effective property to divide the set of instance (in this case, the robot may first ask for the type, and next, depending on the type, for the color or what it eats). ''More details on the Categorization module and its algorithms [[http://homepages.laas.fr/slemaign/doc/oro-server/laas/openrobots/ontology/modules/categorization/CategorizationModule.html|here]].'' === Events module === This module allows the registration of ''cognitive'' events that are triggered when some fact becomes true, or some new object appears. Events are triggered by so-called ''Watchers'' A watcher stores the type of event (cf below) along with the pattern (the form of the pattern depends on the type of event). Following type of events are currently implemented: ==== FACT_CHECKING ==== The watch pattern must be a partial statement. If, when evaluated, it returns true (ie, at least one asserted or inferred statement match the pattern), the event is fired. ==== NEW_INSTANCE ==== The event pattern for this type of event is first a variable and then a set of partial statement. The event is triggered when a new statement matches this set. The server return the list of instance bound to the variable. ===== Example ===== Registration: {{{ > registerEvent > NEW_INSTANCE > ON_TRUE > b > [?a desires ?b, ?a rdf:type Human] }}} Add some facts: {{{ |
Line 90: | Line 211: |
> [human rdf:type Human, human rdfs:label "Ramses", myself sees Ramses] > #end# }}} ==== Retrieving facts ==== This command should return the list of humans the robot currently sees. {{{ > find > [?humans rdf:type Human, myself sees ?humans] > #end# }}} ==== More complete example ==== This Telnet recorded session demonstrates a more complete interaction with the server. It exhibits as well some of the inference abilities (it assumes the server has been started with the `common_sense.oro.owl` ontology). {{{ add [kitchen_table rdf:type Table, fork1 rdf:type Fork, glass1 rdf:type Glass] //we add some objects #end# ok #end# add [fork1 isOn kitchen_table] //we assert that the object "fork1" is on the table #end# ok #end# find o [?o isAt kitchen_table] //we try to retrieve the object co-located with the table #end# ok ["fork1","kitchen_table"] //the server infers that "isOn" implies "isAt" and returns, as expected, the fork #end# registerEvent NEW_INSTANCE ON_TRUE o [?o isAt kitchen_table, ?o rdf:type Artifact] //we register an event that should be triggered when some artifact "isAt" the table #end# ok 78445b39-5cac-49a2-a970-623bbcb09c27 //the server register the event and returns and unique identifier for it #end# //note that no event has been yet triggered. That's because the server doesn't know that a Fork is an Artifact add [Fork rdfs:subClassOf Tableware,Glass rdfs:subClassOf Tableware] //we now add that forks and glasses are tableware (and the server already knows from the common sens ontology that tableware are kind of artifacts) #end# ok #end# event 78445b39-5cac-49a2-a970-623bbcb09c27 //...so the event is now triggered ["fork1"] #end# add [glass1 isOn kitchen_table] #end# ok #end# event 78445b39-5cac-49a2-a970-623bbcb09c27 //and if you add as well a glass on the table, a new event will also be triggered ["glass1"] #end# }}} == C++ bindings == C++ bindings for ORO can be found in the `liboro` library. === Installation === ==== Via robotpkg ==== The supported way to install `liboro` is through '''robotpkg''': Robotpkg is a package management system for robotics module we use at the LAAS. It handles dependencies and compilation automatically. If you don't know it, [[robotpkg.openrobots.org|have a look here]]. Once installed, you can add the `liboro` package very easily: {{{ > cd $ROBOTPKG_BASE/knowledge/liboro > make update }}} You're done! ==== From the sources ==== You can grab a snapshot of the sources on the public FTP: ftp://softs.laas.fr/pub/openrobots/liboro/ Or, to get the latest version of `liboro`, you can check-out the sources with GIT: {{{ > git clone http://softs.laas.fr/git/robots/liboro.git }}} `liboro` uses '''CMake''' (>= 2.6) to compile, and depends only on `boost` (>= 1.34). You can compile it with: {{{ > cd liboro > cmake . > make > make install }}} === API coverage === As of version 0.7.5, the `liboro` C++ bindings cover the following part of the `oro-server` API: * all basic functionalities (`add`, `remove`, `check`, `checkConsistency`...) * queries (`find`, `query`,...) * basic functionalities for multiple agents modeling (`addForAgent`, `findForAgent`...) * events registration, events callback === Usage & library reference === The `liboro` reference is available as Doxygen comments in the source code. It is [[http://homepages.laas.fr/slemaign/doc/liboro/|available on-line]] as well. Some of methods are available as a high-level object-oriented abstraction. For instance: {{{#!highlight c++ //Registers an event on a class: EventCallback ec; Classes::Human.onNewInstance(ec); //Creates a new object ("object" in the ontology meaning): Object table = Object::create(Classes::Table); table.assertThat(Properties::isIn, livingRoom); //Binds concepts: myself.sees(table); }}} === Complete example === This example can be found in the source code: `$PREFIX/oro-apps-src/oro_test.cpp`. {{{#!highlight c++ #include <iostream> #include <iterator> #include <set> #include "liboro/oro.h" #include "liboro/oro_library.h" #include "liboro/socket_connector.h" using namespace std; using namespace oro; class EventCallback : public OroEventObserver { void operator()(const OroEvent& evt) { cout << "Event triggered!" << endl << "Event content: " << endl; set<Concept> evt_content = boost::get<set<Concept> >(evt.content); copy(evt_content.begin(), evt_content.end(), ostream_iterator<Concept>(cout, "\n")); } }; int main(void) { set<Concept> result; set<string> partial_stmts; //liboro currently relies on sockets for the RPCs with the server. //we imagine here that the server runs on the same machine, on port 6969. SocketConnector connector("localhost", "6969"); //The "oro" object is here built as a singleton. //This actually connects the application to the ontology server. Ontology *oro = Ontology::createWithConnector(connector); //First, create some instances (ie, objects). //a new instance of Agent has been created. It is named "Nice Robot" and its // type (or "class") is set to be a Robot (which is a subconcept of Agent). Agent robot1 = Agent::create("Nice Robot", Classes::Robot); //another agent... Agent human = Agent::create("Young PhD", Classes::Human); //Let's try a first, simple query partial_stmts.insert("?mysterious rdf:type Agent"); oro->find("mysterious", partial_stmts, result); //display the results on std_out. It should display two ID (that are the //internal unique identifiers for "Nice Robot" and "Young PhD") + "myself" //which is always defined and refers to the robot itself. copy(result.begin(), result.end(), ostream_iterator<Concept>(cout, "\n")); partial_stmts.clear(); result.clear(); //here, an object is created. No name (or "label") has been set up, but the //class is refined: it's not only an object, but more precisely a table. Object table = Object::create(Classes::Table); //here, an unknown object has been identified, without any more infos. Object unknown_object = Object::create(); //if no setter is available for a given property, then direct assertion can //be made. The list of existing properties and classes come from the oro //ontology itself (from which oro_library.h/cpp is automatically generated) unknown_object.assertThat(Properties::isOnTopOf, table); //We can as well access the ontology at a lower level oro->add(Statement("oro:isOnTopOf rdfs:subClassOf oro:isAt")); //"myself" is a special, unique instance representing the robot itself. //This instance is built from the already existing identifier "myself". //Hence the constructor of the Agent class can be directly called. Agent myself("myself"); myself.sees(unknown_object); myself.sees(human); //Then, try to find back the unknown object... partial_stmts.insert("?mysterious oro:isAt ?table"); partial_stmts.insert("?table rdf:type oro:Table"); partial_stmts.insert("oro:myself oro:sees ?mysterious"); oro->find("mysterious", partial_stmts, result); copy(result.begin(), result.end(), ostream_iterator<Concept>(cout, "\n")); /** EVENTS **/ EventCallback ec; Classes::Human.onNewInstance(ec); Agent superman = Agent::create("Superman", Classes::Human); cout << "Sleeping for 1 sec..." << endl; sleep(1); set<string> event_pattern; Property flyingProp = Property("isFlying"); event_pattern.insert( superman.id() + " isFlying true"); oro->registerEvent(ec, FACT_CHECKING, ON_TRUE_ONE_SHOT, event_pattern, ""); superman.assertThat(flyingProp, "true"); cout << "Sleeping for 1 sec..." << endl; sleep(1); return 0; } }}} == Python bindings == Python bindings for ORO can be found in the `pyoro` library. === Installation === ==== From the sources ==== To get the latest version of `pyoro`, you can check-out the sources with GIT: {{{ > git clone http://softs.laas.fr/git/robots/pyoro.git }}} To install `pyoro` on your system, simply run with root privileges {{{ > python setup.py install }}} === Usage & library reference === The connection to an `oro-server` instance is initialized this way: {{{#!highlight python import time from pyoro import Oro #We suppose the server to be running on the same machine, on port 6969 oro = Oro("localhost", 6969) }}} The `pyoro` binding dynamically creates at startup Python method for every available RPC method ([[#index_of_available_methods|as listed at the bottom of this page]]). They can be directly called through the `Oro` object: {{{#!highlight python oro.<method name>(<param1>, <param2>, <...>)) }}} Besides the raw API, several more "Python friendly" shortcuts are available: * `dict`-like accessor For instance, the following code snippet would iterate over all concepts asserted of inferred to be humans: {{{#!highlight python for human in oro["* rdf:type Human"]: ... }}} * TO BE CONTINUED! === API coverage === As of version 0.8.0, the `pyoro` Python bindings cover all the `oro-server` API, including events. === Simple example === This example is very incomplete. Please refer to the [[#index_of_available_methods|list of RPC methods]] below for the list of all possible RPC calls. {{{#!highlight python import time from pyoro import Oro, OroServerError def printer(content): print("God save the queen! " + content + " killed Bond!") try: oro = Oro("localhost", 6969) oro.add("[bond rdf:type Human, bond rdfs:label \"Bond, James Bond\"]") oro.add("[hrp2 rdf:type Robot]") print(oro.lookup("Bond, James Bond")[0]) oro.subscribe(["?a kills bond"], printer) oro.add("[hrp2 kills bond]") time.sleep(1) except OroServerError as ose: print('Oups! An error occured!') print(ose) finally: oro.close() }}} == TCL bindings == TCL bindings for ORO can be found in the `oro-tcl` library. The library source has a `examples/` directory that should help to start. === Installation === ==== From the sources ==== To get the latest version of `oro-tcl`, you can check-out the sources with GIT: {{{ > git clone http://softs.laas.fr/git/robots/oro-tcl.git }}} === Simple usage example === {{{#!highlight tcl source oro.tcl global sockChan oro_add {[fsh4r5g2 rdf:type Human, fsh4r5g2 rdfs:label "Raquel"]} oro_add {[Akin rdf:type Human]} oro_getInfos "fsh4r5g2" oro_lookup "fsh4r5g2" oro_lookup "Raquel" oro_find "?var" {[?var rdf:type Human]} oro_getDirectInstancesOf "Human" }}} == Bindings with robotic middlewares == === ROS bindings === The [[http://www.ros.org|ROS]] bindings are available as a Python ROS node. This node relies on the [[#python|Python bindings]] to communicate with the server. The code is available in the TUM ROS repository or can be provided on demand. At start-up, the ROS node will fetch from ORO the list of [[#index_of_available_methods|available methods]] and will create a new ''ROS service'' for each of them (like `oro/add` or `oro/findForAgent` - names are case-sensitive). All services take as parameter '''one array of parameters'''. This array may contain 0, 1 or more '''strings'''. The arity of methods varies for each service. Please refer the the [[#index_of_available_methods|list of RPC methods]] (and please note as well that some methods are polymorphic: the server will rely on the number and the type of the parameters you provide to select the right one). The elements of the parameters array are always strings. But some (actually, a lot!) of ORO methods take an array as parameter. For instance, `add` expect an array of statements to add to the ontology. A statement is a string of this kind: `"subject predicate object"` (for instance, `"robot likes disco_music")`. In [[http://www.json.org|JSON]], we can write `["robot likes disco_music", "disco_music rdf:type Music"]` to represent an array of string. We need to serialize this array of string in one single string, since ROS expect only strings as parameter. So we need to double escape our strings, and send `"[\"robot likes disco_music\", \"disco_music rdf:type Music\"]"` At the end, we would call the ROS service in Python, like that: {{{#!highlight python oro_add = rospy.ServiceProxy('oro/add', OroServerQuery) response = oro_add(["[\"robot likes disco_music\", \"disco_music rdf:type Music\"]"]) }}} Below a sample Python program that ask for ORO methods with parameters and query the knowledge base through ROS: {{{#!highlight python import roslib; roslib.load_manifest('oro_ros') import sys import rospy from oro_ros.srv import * def oro_ros_client(query, params): rospy.wait_for_service('oro/' + query) try: query_oro_server = rospy.ServiceProxy('oro/' + query, OroServerQuery) resp1 = query_oro_server(params) return resp1.res except rospy.ServiceException, e: print "Service call failed: %s"%e def usage(): return "%s query [param1, param2, ...]"%sys.argv[0] if __name__ == "__main__": if len(sys.argv) == 1: print usage() sys.exit(1) query = sys.argv[1] params = sys.argv[2:] print "%s %s => %s"%(query, params, oro_ros_client(query, params)) }}} === YARP bindings === ''[AVAILABLE, BUT DOCUMENTATION TO DO... if needed, drop me a mail]'' === OpenPRS bindings === `OpenPRS` is an open source version of `PRS` (Procedural Reasoning Systems). [[https://softs.laas.fr/openrobots/wiki/openprs|More infos here]]. ==== Installation ==== To get the latest version of the `oro-oprs` connector, you can check-out the sources with GIT: {{{ > git clone http://trac.laas.fr/git/robots/oro-oprs-connector.git }}} `oro-oprs-connector` uses '''CMake''' (>= 2.6) to compile. It depends on `boost` (>= 1.37), [[#cpp|`liboro`]] and `OpenPRS`. You can compile it with: {{{ > cd oro-oprs-connector > cmake . > make > make install }}} It creates a executable, `oro-oprs`, that must be started with 6 parameters. For instance: {{{ > oro-oprs localhost 6969 localhost 3300 OPRS-MODULE ONTO_OPRS_INTERFACE }}} where `localhost:6969` is the host and port of ORO server and `localhost:3300` is the host of the OPRS message passer. ==== Usage ==== The `oro-oprs` usage documentation is available as Doxygen comments in the source code. It is [[http://homepages.laas.fr/slemaign/doc/oro-oprs/|available on-line]]. == Index of available methods == ''(Last updated on 2010-10-19 02:24:26)'' * administration * [[http://homepages.laas.fr/slemaign/doc/oro-server/laas/openrobots/ontology/OroServer.html#makeHtmlDoc()|''makeHtmlDoc''''()'']]: returns a list of available methods in HTML format for inclusion in documentation. * [[http://homepages.laas.fr/slemaign/doc/oro-server/laas/openrobots/ontology/OroServer.html#listMethods()|''listMethods''''()'']]: returns the list of available methods with their signatures and short descriptions as a map. * [[http://homepages.laas.fr/slemaign/doc/oro-server/laas/openrobots/ontology/OroServer.html#listSimpleMethods()|''listSimpleMethods''''()'']]: returns a raw list of available methods. * [[http://homepages.laas.fr/slemaign/doc/oro-server/laas/openrobots/ontology/OroServer.html#stats()|''stats''''()'']]: returns some statistics on the server * [[http://homepages.laas.fr/slemaign/doc/oro-server/laas/openrobots/ontology/OroServer.html#reset()|''reset''''()'']]: Reload the base ontologies, discarding all inserted of removed statements, in every models * [[http://homepages.laas.fr/slemaign/doc/oro-server/laas/openrobots/ontology/backends/OpenRobotsOntology.html#save()|''save''''()'']]: exports the current ontology model to an OWL file. The file will be saved to the current directory with an automaticallygenerated name. * [[http://homepages.laas.fr/slemaign/doc/oro-server/laas/openrobots/ontology/backends/OpenRobotsOntology.html#save(java.lang.String)|''save''''(String)'']]: exports the current ontology model to an OWL file. The provided path must be writable by the server. * agent * [[http://homepages.laas.fr/slemaign/doc/oro-server/laas/openrobots/ontology/modules/alterite/AlteriteModule.html#getInfosForAgent(java.lang.String, java.lang.String)|''getInfosForAgent''''(String, String)'']]: returns the set of asserted and inferred statements whose the given node is part of. It represents the usages of a resource. * agents * [[http://homepages.laas.fr/slemaign/doc/oro-server/laas/openrobots/ontology/modules/alterite/AlteriteModule.html#safeAddForAgent(java.lang.String, java.util.Set)|''safeAddForAgent''''(String, Set)'']]: try to add news statements to a specific agent model in long term memory, if they don't lead to inconsistencies (return false if at least one stmt wasn't added). * [[http://homepages.laas.fr/slemaign/doc/oro-server/laas/openrobots/ontology/modules/alterite/AlteriteModule.html#safeAddForAgent(java.lang.String, java.util.Set, java.lang.String)|''safeAddForAgent''''(String, Set, String)'']]: try to add news statements to a specific agent model with a specific memory profile, if they don't lead to inconsistencies (return false if at least one stmt wasn't added). * [[http://homepages.laas.fr/slemaign/doc/oro-server/laas/openrobots/ontology/modules/alterite/AlteriteModule.html#discriminateForAgent(java.lang.String, java.util.Set)|''discriminateForAgent''''(String, Set)'']]: returns a list of properties that helps to differentiate individuals for a specific agent. * [[http://homepages.laas.fr/slemaign/doc/oro-server/laas/openrobots/ontology/modules/alterite/AlteriteModule.html#findForAgent(java.lang.String, java.lang.String, java.util.Set)|''findForAgent''''(String, String, Set)'']]: tries to identify a resource given a set of partially defined statements in an specific agent model. * [[http://homepages.laas.fr/slemaign/doc/oro-server/laas/openrobots/ontology/modules/alterite/AlteriteModule.html#findForAgent(java.lang.String, java.lang.String, java.util.Set, java.util.Set)|''findForAgent''''(String, String, Set, Set)'']]: tries to identify a resource given a set of partially defined statements and restrictions in an specific agent model. * [[http://homepages.laas.fr/slemaign/doc/oro-server/laas/openrobots/ontology/modules/alterite/AlteriteModule.html#listAgents()|''listAgents''''()'']]: Returns the set of agents I'm aware of (ie, for whom I have a cognitive model). * [[http://homepages.laas.fr/slemaign/doc/oro-server/laas/openrobots/ontology/modules/alterite/AlteriteModule.html#lookupForAgent(java.lang.String, java.lang.String)|''lookupForAgent''''(String, String)'']]: lookup a concept in a specific agent model. * [[http://homepages.laas.fr/slemaign/doc/oro-server/laas/openrobots/ontology/modules/alterite/AlteriteModule.html#addForAgent(java.lang.String, java.util.Set)|''addForAgent''''(String, Set)'']]: adds one or several statements (triplets S-P-O) to a specific agent model, in long term memory. * [[http://homepages.laas.fr/slemaign/doc/oro-server/laas/openrobots/ontology/modules/alterite/AlteriteModule.html#addForAgent(java.lang.String, java.util.Set, java.lang.String)|''addForAgent''''(String, Set, String)'']]: adds one or several statements (triplets S-P-O) to a specific agent model associated with a memory profile. * [[http://homepages.laas.fr/slemaign/doc/oro-server/laas/openrobots/ontology/modules/alterite/AlteriteModule.html#clearForAgent(java.lang.String, java.util.Set)|''clearForAgent''''(String, Set)'']]: removes statements from a specific matching any pattern in the given set. * [[http://homepages.laas.fr/slemaign/doc/oro-server/laas/openrobots/ontology/modules/alterite/AlteriteModule.html#removeForAgent(java.lang.String, java.util.Set)|''removeForAgent''''(String, Set)'']]: removes one or several statements (triplets S-P-O) from a specific agent model, in long term memory. * [[http://homepages.laas.fr/slemaign/doc/oro-server/laas/openrobots/ontology/modules/alterite/AlteriteModule.html#save(java.lang.String, java.lang.String)|''save''''(String, String)'']]: exports the cognitive model of a given agent to an OWL file. The provided path must be writable by the server. * [[http://homepages.laas.fr/slemaign/doc/oro-server/laas/openrobots/ontology/modules/alterite/AlteriteModule.html#updateForAgent(java.lang.String, java.util.Set)|''updateForAgent''''(String, Set)'']]: updates one or several statements (triplets S-P-O) in a specific agent model, in long term memory. * base * [[http://homepages.laas.fr/slemaign/doc/oro-server/laas/openrobots/ontology/modules/base/BaseModule.html#safeAdd(java.util.Set)|''safeAdd''''(Set)'']]: try to add news statements in long term memory, if they don't lead to inconsistencies (return false if at least one stmt wasn't added). * [[http://homepages.laas.fr/slemaign/doc/oro-server/laas/openrobots/ontology/modules/base/BaseModule.html#safeAdd(java.util.Set, java.lang.String)|''safeAdd''''(Set, String)'']]: try to add news statements with a specific memory profile, if they don't lead to inconsistencies (return false if at least one stmt wasn't added). * [[http://homepages.laas.fr/slemaign/doc/oro-server/laas/openrobots/ontology/modules/base/BaseModule.html#check(java.util.Set)|''check''''(Set)'']]: checks that one or several statements are asserted or can be inferred from the ontology * [[http://homepages.laas.fr/slemaign/doc/oro-server/laas/openrobots/ontology/modules/base/BaseModule.html#checkConsistency()|''checkConsistency''''()'']]: checks that the ontology is semantically consistent * [[http://homepages.laas.fr/slemaign/doc/oro-server/laas/openrobots/ontology/OroServer.html#help()|''help''''()'']]: returns a human-friendly list of available methods with their signatures and short descriptions. * [[http://homepages.laas.fr/slemaign/doc/oro-server/laas/openrobots/ontology/modules/base/BaseModule.html#getLabel(java.lang.String)|''getLabel''''(String)'']]: return the label of a concept, if available. * [[http://homepages.laas.fr/slemaign/doc/oro-server/laas/openrobots/ontology/modules/base/BaseModule.html#lookup(java.lang.String)|''lookup''''(String)'']]: try to identify a concept from its id or label, and return it, along with its type (class, instance, object_property, datatype_property). * [[http://homepages.laas.fr/slemaign/doc/oro-server/laas/openrobots/ontology/modules/base/BaseModule.html#lookup(java.lang.String, java.lang.String)|''lookup''''(String, String)'']]: try to identify a concept from its id or label and its type (class, instance, object_property, datatype_property). * [[http://homepages.laas.fr/slemaign/doc/oro-server/laas/openrobots/ontology/modules/base/BaseModule.html#add(java.util.Set)|''add''''(Set)'']]: adds one or several statements (triplets S-P-O) to the robot model, in long term memory. * [[http://homepages.laas.fr/slemaign/doc/oro-server/laas/openrobots/ontology/modules/base/BaseModule.html#add(java.util.Set, java.lang.String)|''add''''(Set, String)'']]: adds one or several statements (triplets S-P-O) to the robot model associated with a memory profile. * [[http://homepages.laas.fr/slemaign/doc/oro-server/laas/openrobots/ontology/modules/base/BaseModule.html#clear(java.util.Set)|''clear''''(Set)'']]: removes statements matching any pattern in the given set * [[http://homepages.laas.fr/slemaign/doc/oro-server/laas/openrobots/ontology/modules/base/BaseModule.html#remove(java.util.Set)|''remove''''(Set)'']]: removes one or several statements (triplets S-P-O) from the ontology. * [[http://homepages.laas.fr/slemaign/doc/oro-server/laas/openrobots/ontology/modules/base/BaseModule.html#update(java.util.Set)|''update''''(Set)'']]: update the value of a functional property. * concept comparison * [[http://homepages.laas.fr/slemaign/doc/oro-server/laas/openrobots/ontology/modules/categorization/CategorizationModule.html#discriminate(java.util.Set)|''discriminate''''(Set)'']]: returns a list of properties that helps to differentiate individuals. * [[http://homepages.laas.fr/slemaign/doc/oro-server/laas/openrobots/ontology/modules/categorization/CategorizationModule.html#getDifferences(java.lang.String, java.lang.String)|''getDifferences''''(String, String)'']]: given two concepts, return the list of relevant differences (types, properties...) between these concepts. * [[http://homepages.laas.fr/slemaign/doc/oro-server/laas/openrobots/ontology/modules/categorization/CategorizationModule.html#getSimilarities(java.lang.String, java.lang.String)|''getSimilarities''''(String, String)'']]: given two concepts, return the list of relevant similarities (types, properties...) between these concepts. * events * ''registerEvent''''(String, String, String, List)'': registers an event. Expected parameters are: type, triggering type, variable, event pattern. * ''registerEvent''''(String, String, List)'': registers an event. Expected parameters are: type, triggering type, event pattern. * querying * [[http://homepages.laas.fr/slemaign/doc/oro-server/laas/openrobots/ontology/modules/base/BaseModule.html#find(java.lang.String, java.util.Set)|''find''''(String, Set)'']]: tries to identify a resource given a set of partially defined statements about this resource. * [[http://homepages.laas.fr/slemaign/doc/oro-server/laas/openrobots/ontology/modules/base/BaseModule.html#find(java.lang.String, java.util.Set, java.util.Set)|''find''''(String, Set, Set)'']]: tries to identify a resource given a set of partially defined statements plus restrictions about this resource. * [[http://homepages.laas.fr/slemaign/doc/oro-server/laas/openrobots/ontology/modules/base/BaseModule.html#getInfos(java.lang.String)|''getInfos''''(String)'']]: returns the set of asserted and inferred statements whose the given node is part of. It represents the usages of a resource. * [[http://homepages.laas.fr/slemaign/doc/oro-server/laas/openrobots/ontology/modules/base/BaseModule.html#query(java.lang.String, java.lang.String)|''query''''(String, String)'']]: performs one SPARQL query on the ontology * [[http://homepages.laas.fr/slemaign/doc/oro-server/laas/openrobots/ontology/modules/base/BaseModule.html#getResourceDetails(java.lang.String)|''getResourceDetails''''(String)'']]: returns a serialized ResourceDescription object that describe all the links of this resource with others resources (sub and superclasses, instances, properties, etc.). * [[http://homepages.laas.fr/slemaign/doc/oro-server/laas/openrobots/ontology/modules/base/BaseModule.html#getResourceDetails(java.lang.String, java.lang.String)|''getResourceDetails''''(String, String)'']]: returns a serialized ResourceDescription object that describe all the links of this resource with others resources (sub and superclasses, instances, properties, etc.). The second parameter specify the desired language (following RFC4646). * taxonomy * [[http://homepages.laas.fr/slemaign/doc/oro-server/laas/openrobots/ontology/modules/base/BaseModule.html#getClassesOf(java.lang.String)|''getClassesOf''''(String)'']]: returns a map of {class name, label} (or {class name, class name without namespace} is no label is available) of asserted and inferred classes of a given individual. * [[http://homepages.laas.fr/slemaign/doc/oro-server/laas/openrobots/ontology/modules/base/BaseModule.html#getDirectClassesOf(java.lang.String)|''getDirectClassesOf''''(String)'']]: returns a map of {class name, label} (or {class name, class name without namespace} is no label is available) of asserted and inferred direct classes of a given individual. * [[http://homepages.laas.fr/slemaign/doc/oro-server/laas/openrobots/ontology/modules/base/BaseModule.html#getDirectInstancesOf(java.lang.String)|''getDirectInstancesOf''''(String)'']]: returns a map of {instance name, label} (or {instance name, instance name without namespace} is no label is available) of asserted and inferred direct instances of a given class. * [[http://homepages.laas.fr/slemaign/doc/oro-server/laas/openrobots/ontology/modules/base/BaseModule.html#getDirectSubclassesOf(java.lang.String)|''getDirectSubclassesOf''''(String)'']]: returns a map of {class name, label} (or {class name, class name without namespace} is no label is available) of all asserted and inferred direct subclasses of a given class. * [[http://homepages.laas.fr/slemaign/doc/oro-server/laas/openrobots/ontology/modules/base/BaseModule.html#getDirectSuperclassesOf(java.lang.String)|''getDirectSuperclassesOf''''(String)'']]: returns a map of {class name, label} (or {class name, class name without namespace} is no label is available) of all asserted and inferred direct superclasses of a given class. * [[http://homepages.laas.fr/slemaign/doc/oro-server/laas/openrobots/ontology/modules/base/BaseModule.html#getInstancesOf(java.lang.String)|''getInstancesOf''''(String)'']]: returns a map of {instance name, label} (or {instance name, instance name without namespace} is no label is available) of asserted and inferred instances of a given class. * [[http://homepages.laas.fr/slemaign/doc/oro-server/laas/openrobots/ontology/modules/base/BaseModule.html#getSubclassesOf(java.lang.String)|''getSubclassesOf''''(String)'']]: returns a map of {class name, label} (or {class name, class name without namespace} is no label is available) of all asserted and inferred subclasses of a given class. * [[http://homepages.laas.fr/slemaign/doc/oro-server/laas/openrobots/ontology/modules/base/BaseModule.html#getSuperclassesOf(java.lang.String)|''getSuperclassesOf''''(String)'']]: returns a map of {class name, label} (or {class name, class name without namespace} is no label is available) of all asserted and inferred superclasses of a given class. |
> [ramses rdf:type Human, pyramidInauguration rdf:type StaticSituation, ramses desires pyramidInauguration] }}} This would fire the event and return: {{{ > event > [pyramidInauguration] }}} ==== NEW_CLASS_INSTANCE ==== The event is triggered when a new instance of the class returned by the watch pattern is added. When the event is fired, the server send to the client the list of the new instances. This kind of event is a special, optimized version of `NEW_INSTANCE` for class instances. === Memory module === The "Memory module" provides a memory management system that allows the robot to forget about facts after a while. Reinforcement learning is planned but not yet implemented as of December 2009. == Interfacing with ORO == ORO offers numerous way to interface, either through direct socket connection, language-specific bindings or robotics middleware abstractions. The documentation is available on this page: '''[[oro-server-bindings| Interfacing with ORO]]'''. == Extending ORO == Since version 0.7.2, it's very easy to extend ORO with you own plugins. A complete tutorial is available on this page: '''[[oro-server-plugins| Writing plugins for ORO]]'''. |
|
Introducing ORO, the OpenRobots Ontology cognitive kernel
oro-server (or, in short, ORO) is a Java-based knowledge base for cognitive robotic applications. It is developped at the LAAS-CNRS, France and IAS-Technische Universität München, Germany by Séverin Lemaignan (severin.lemaignan@laas.fr)
This page introduces the OpenRobots Ontology server ideas and features. The complete, up-to-date developers' documentation of oro-server can be found here. Informations on this page are based on oro-server 0.7.2, as of February 2010.
Summary
What is ORO
Introducing a cognitive layer
Robots interacting with complex, human-inhabited, environments are expected to exhibit advanced cognitive skills: objects recognition, natural language interactions, task planning with possible dynamic replanning, ability to cooperate with other robots or humans, etc.
These functions, while being scientific challenges partially independent from each other, need to communicate, and thus to share a common representation of concepts of the world, to be effectively combined in a complete, autonomous, robotic system.
The oro-server project focuses precisely on the implementation of such a common description framework, along with a library of basic, reusable cognitive functions. This so-called cognitive kernel is actually build as a server that maps cognitive service to a ontology-based backend.
Amongst other features, these base cognitive functions include:
Easy addition or removal of statements on the world (ie, truths for the robot's model): add [aibo sees green_bottle],
Arbitrary complex queries, based on SPARQL: find robots [?robots sees ?object, ?object hasShape cylinder] [?robot hasWeight > 100],
Classification, rules application, first logic order reasonning on the set of statements, through the Pellet library.
Possibility to assign to statements memory profiles that cause the robot to forget such facts after a predefinied amount of time,
- Event system that triggers subscribed listeners, for instance when a fact becomes a true or a new object is discovered,
- Categorization skills to find similarities or differences between concepts,
- Explicit representation of other agents own world models (a bottle can be half full for the robot and half empty for another agent)
|
In practical terms, oro-server does mainly two things:
- it registers and connects a set of services (presumably related to robotic cognition) to a socket interface,
- it runs in the background several tasks to maintain the knowledge base.
It relies on RDF/OWL ontologies to represent an store knowledge and runs several active processes that offer, amongst other things, reasonning facilities, support for bio-inspired memory models, concepts of "cognitive events", categorization and explicit modeling of other agents.
Planned features include reinforcement learning, pro-active "curiosity" and mechanisms to handle cognitive conflicts (ie inconsistent chuncks of knowledge).
What can it be used for?
Upon these bricks, it possible to build semantic-aware layers and applications.
At the system level, such a cognitive kernel allows:
to formally and explicitely represent the "knowledge" of the robot. The concepts present at any time in the cognitive kernel define the close set of what the robot can make sense of (noting that this set can of course grow and evolve during an experiment lifetime).
to check on real time the logical consistency of this knowledge, and to determine possible sources of inconsistencies,
it provides inference mechanisms, such as inheritance of concept properties,
it offers a system-wide and exhaustive concept naming scheme that participates in overcoming the grounding issue by enabling heterogeneous components to share a common symbolic model,
it eases as well the process of matching and making sense of natural language interactions. First because the underlying backend ontology is rooted into human language (cf Wordnet, OpenCyc) and can associate human-intelligible labels to concept, then because it is possible to automatically retrieve synonyms (ie alternate labels) for the concepts known by the robot, which is useful to overcome expression difference when interacting with humans.
|
At the application level, ORO enables to built semantic and context-aware components. Example of applications include:
[LIST TO BE UPDATED]
- link symbols to representation
- semantic projection
- spy game
Installation
Via robotpkg
The supported way to install oro-server is through robotpkg:
Robotpkg is a package management system for robotics module we use at the LAAS. It handles dependencies and compilation automatically. If you don't know it, have a look here.
Once installed, you can add the oro-server package very easily:
> cd $ROBOTPKG_BASE/knowledge/oro-server > make update
- You're done!
From the sources
You can grab a snapshot of the sources on the public FTP: ftp://softs.laas.fr/pub/openrobots/oro-server/
Or, to get the latest version of oro-server, you can check-out the sources with GIT:
> git clone http://softs.laas.fr/git/robots/oro-server.git
To run the ontology server, you'll need Java JRE >= 1.6. The two only dependencies of oro-server are on Jena >= 2.6.2 and Pellet >=2.0.
By default, the Makefile expect following paths for these library:
$PREFIX/java/jena/lib $PREFIX/java/pellet/lib
You can override these defaults by setting the $JENA_LIBS and $PELLET_LIBS with your custom paths.
You can then compile it with:
> cd oro-server > make PREFIX=[your prefix] install > make PREFIX=[your prefix] install-doc
If everything went fine, a executable script called oro-server should have been created in $PREFIX/bin.
Before starting the server, you can tune the options in $PREFIX/etc/oro-server/oro.conf. In particular, check the path to the ontology you want to load is correctly set up. If you don't have yet any ontology to play with, grab a fresh (January 2010) snapshot here or check the OpenRobotsOntology page on my Wiki.
The OpenRobots Common Sense ontology
The knowledge that the robot acquires need to be somehow connected to other chunks of knowledge to become actually useful (enabling inference, contextualisation, efficient querying, etc.). This requires a common-denominator for the overall knowledge structure: users of the knowledge base must agree on common identifiers to symbolize identical concepts. This is provided by a "upper" common-sense ontology that can be loaded at the server startup.
The common-sense ontology has its own page: OpenRobots Common Sense ontology.
oro-server features
The server features the complete range of basic knowledge management (like adding, removing or querying facts. Check the list below). It supports as well a set of more advanced cognitive-related functions:
Alterite module
- The "Alterité" (from French "otherness") module allows explicit representation of other agents with independant models of the world.
Categorization module
The "Categorization" module provides methods to extract similarities, differences and categories from a set of concepts. Several methods are offered, like discriminate that returns a list of properties that helps to differentiate individuals. For instance, let consider the following ontology, with four instances (plant1, animal1, animal2, animal3) :
+-------+ | Thing | +--,'.--+ .-' `-. ,' `. ,' `-. .-' `. +----+--+ +--+-----+ | Plant | | Animal | +---+---+ +--+++---+ | _,-" | `--.._ | .-' | ``--.. plant1 animal1 animal2 animal3 | | / `. \ | | / `-. \ hasColor eats eats hasColor hasColor | | | | | | | | | | green banana grass blue red
If the robot wants to answer an ambigious order like Give me the thing!, it needs a way to disambiguate the different possible individuals in the Thing class.
The discriminate method would return the most effective property to divide the set of instance (in this case, the robot may first ask for the type, and next, depending on the type, for the color or what it eats).
More details on the Categorization module and its algorithms here.
Events module
This module allows the registration of cognitive events that are triggered when some fact becomes true, or some new object appears.
Events are triggered by so-called Watchers
A watcher stores the type of event (cf below) along with the pattern (the form of the pattern depends on the type of event).
Following type of events are currently implemented:
FACT_CHECKING
- The watch pattern must be a partial statement. If, when evaluated, it returns true (ie, at least one asserted or inferred statement match the pattern), the event is fired.
NEW_INSTANCE
- The event pattern for this type of event is first a variable and then a set of partial statement. The event is triggered when a new statement matches this set. The server return the list of instance bound to the variable.
Example
- Registration:
> registerEvent > NEW_INSTANCE > ON_TRUE > b > [?a desires ?b, ?a rdf:type Human]
- Add some facts:
> add > [ramses rdf:type Human, pyramidInauguration rdf:type StaticSituation, ramses desires pyramidInauguration]
- This would fire the event and return:
> event > [pyramidInauguration]
NEW_CLASS_INSTANCE
The event is triggered when a new instance of the class returned by the watch pattern is added. When the event is fired, the server send to the client the list of the new instances. This kind of event is a special, optimized version of NEW_INSTANCE for class instances.
Memory module
The "Memory module" provides a memory management system that allows the robot to forget about facts after a while. Reinforcement learning is planned but not yet implemented as of December 2009.
Interfacing with ORO
ORO offers numerous way to interface, either through direct socket connection, language-specific bindings or robotics middleware abstractions.
The documentation is available on this page: Interfacing with ORO.
Extending ORO
Since version 0.7.2, it's very easy to extend ORO with you own plugins.
A complete tutorial is available on this page: Writing plugins for ORO.