Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Next revision
Previous revision
Next revisionBoth sides next revision
loading_files_and_ros_packages [2012/12/01 10:41] – created tenorthloading_files_and_ros_packages [2013/02/12 17:41] – external edit 127.0.0.1
Line 1: Line 1:
 +====== Loading files and ROS packages ======
 +~~NOTOC~~
 There are different ways how OWL and Prolog files can be loaded. For testing purposes, one can load single files. For deployment, one usually wants to set up a ROS package in such a way that all related files are automatically loaded. Both alternatives will be explained below. There are different ways how OWL and Prolog files can be loaded. For testing purposes, one can load single files. For deployment, one usually wants to set up a ROS package in such a way that all related files are automatically loaded. Both alternatives will be explained below.
  
 =====  Loading OWL files  ===== =====  Loading OWL files  =====
 OWL files need to be parsed to be [[http://www.swi-prolog.org/pldoc/package/semweb.html|internally represented as Prolog triples]]. Parsing is done using the [[http://www.semanticweb.gr/thea/index.html|Thea library (version 0.5)]]. The following command can be used to load an OWL file: OWL files need to be parsed to be [[http://www.swi-prolog.org/pldoc/package/semweb.html|internally represented as Prolog triples]]. Parsing is done using the [[http://www.semanticweb.gr/thea/index.html|Thea library (version 0.5)]]. The following command can be used to load an OWL file:
 +
 +<code>
  owl_parse('path/to/file.owl', false, false, true).  owl_parse('path/to/file.owl', false, false, true).
 +</code>
  
 =====  Loading Prolog modules  ===== =====  Loading Prolog modules  =====
 Most functionality in KnowRob is contained in [[http://www.swi-prolog.org/pldoc/doc_for?object=section%281,%275%27,swi%28%27/doc/Manual/modules.html%27%29%29|Prolog modules]]. They can be loaded using the use_module directive. The module needs to be either somewhere in the Prolog 'library' path or be referenced relative to the current working directory: Most functionality in KnowRob is contained in [[http://www.swi-prolog.org/pldoc/doc_for?object=section%281,%275%27,swi%28%27/doc/Manual/modules.html%27%29%29|Prolog modules]]. They can be loaded using the use_module directive. The module needs to be either somewhere in the Prolog 'library' path or be referenced relative to the current working directory:
 +<code>
  use_module(library('module-name')).  use_module(library('module-name')).
  use_module('path/to/module-name').  use_module('path/to/module-name').
 +</code>
  
 =====  Loading OWL/Prolog files in ROS packages  ===== =====  Loading OWL/Prolog files in ROS packages  =====
Line 17: Line 24:
  
 Each KnowRob ROS package can be loaded using the following predicate: Each KnowRob ROS package can be loaded using the following predicate:
 +<code>
  register_ros_package('pkg-name').  register_ros_package('pkg-name').
 +</code>
  
 Alternatively, one can launch KnowRob giving the respective package as argument to rosprolog: Alternatively, one can launch KnowRob giving the respective package as argument to rosprolog:
 +<code>
  rosrun rosprolog rosprolog pkg-name  rosrun rosprolog rosprolog pkg-name
 +</code>
  
 =====  Exporting knowledge into OWL files  ===== =====  Exporting knowledge into OWL files  =====
 At some point, you may want to create OWL files. This can be done with the predicates in the 'owl_export' module in the 'knowrob_common' package: At some point, you may want to create OWL files. This can be done with the predicates in the 'owl_export' module in the 'knowrob_common' package:
  
 +<code>
  % Export the perception of an object to an OWL file  % Export the perception of an object to an OWL file
  export_object(knowrob:'Drawer1', 'path/to/object.owl').  export_object(knowrob:'Drawer1', 'path/to/object.owl').
Line 37: Line 48:
  % Export an action specification (TBOX) to an OWL file  % Export an action specification (TBOX) to an OWL file
  export_action(knowrob:'PickingUpAnObject', 'path/to/action.owl').  export_action(knowrob:'PickingUpAnObject', 'path/to/action.owl').
 +</code>