Coder Social home page Coder Social logo

armor's Introduction

ARMOR

A ROS Multi-Ontology Reference

ARMOR is a powerful and versatile management system for single and multi-ontology architectures under ROS. It allows to load, query and modify multiple ontologies and requires very little knowledge of OWL APIs and Java. Despite its ease of use, ARMOR provides a large share of OWL APIs functions and capabilities in a simple server-client architecture and offers increased flexibility compared to previous ontological systems running under ROS.

ARMOR's main goal is to ease the use of ontologies in robotics by bringing these features to developers working under ROS. Not everyone in the ROS community is a Java developer, it is even rarer to find someone familiar with OWL APIs. ARMOR hides such implementation details and speeds up the development of applications based on semantic knowledge. Notable features include:

  • Support for multiple ontologies
  • Ensures thread-safe ontology manipulations
  • Implements a wide range of functions: from simple "add an individual" to more esoteric "modify an SWRL rule"
  • Excellent performances which can be further customized based on user needs
  • Ontology debug GUI available (currently working but not stable)
  • Extensive logging
  • Out-of-the-box support for most reasoners, easy to add more
  • Based on latest standards: Java 8 and OWL API 5
  • Support for SPARQL queries (Only with Pellet/Openllet)

ARMOR is based on AMOR - a Multi-Ontology Reference library (a ROS ready version is available here), offering a service-client interface for the vast majority of its functions, with some exceptions of rarer use. As a rule of thumb, as long as you create your own ontology offline and use ARMOR at runtime to populate, modify and query it; you should be good to go.

ARMOR expands AMOR capabilities in the following ways:

  • Flexible mount system, allows one or more ROS clients to identify themselves and mount on an ontology reference to prevent other processes from modifying its state. Excluded processes can still query the locked ontologies to avoid waiting for long times.
  • Easy debugging, allows online toggling of terminal/file logging as well as turn on AMOR debug GUI.

Legacy support for OWL api 3.4.5 is available on the OWL-api3 branch. Use it in conjunction with AMOR OWL-api3 branch.

Installation and dependencies

The latest stable release of this project and its dependencies (ARMOR, AMOR, the required ROS messages and a Python client) can be installed directly from here. Check also the RDS tutorial we made to showcase ARMOR.

Else, you can manually download the latest release of each module from the following repositories:

To build both AMOR and ARMOR, you will need Rosjava installed.

We experienced some installation issues with the newest ROS version. To succesfully install ARMOR in this case, follow the steps available here.

Running ARMOR

Launching rosjava nodes can be a convoluted operation. To make things easier, after building the package for the first time go to the project directory and run the following command:

./gradlew deployApp

This is necessary only the first time you build the package or after you hard clean your workspace. You can then launch ARMOR from the command line:

rosrun armor execute it.emarolab.armor.ARMORMainService

Or from a launchfile:

<node pkg="armor" type="execute" name="armor_service" args="it.emarolab.armor.ARMORMainService"/>

Client

Once ARMOR is running, you can call it fom any client node written in your preferred language (C++, Python or Java). As an example, you can have a look at armor_py, a client library written in Python. The library currently implements only a small number of functions, but they are stable and more will be added as they are needed.

If you feel brave, you are comfortable with Java and you need some advanced feature and increased control over your system, consider to incorporate AMOR in your code instead of using ARMOR.

Rosparams

Rosparam name Type Function Default
FULL_ENTITY_IDENTIFIER Bool If True, queries returns entities with full IRI. False
SHOW_GUI Bool If True, it shows AMOR's debug GUI. False

Message structure

Use /armor_interface_srv for single calls:

rosservice call /armor_interface_srv "armor_request:
  client_name: ''
  reference_name: ''
  command: ''
  primary_command_spec: ''
  secondary_command_spec: ''
  args: ['']"  

Use /armor_interface_serialized_srv to execute multiple operations:

rosservice call /armor_interface_serialized_srv "armor_requests:
   - client_name: ''
     reference_name: ''
     command: ''
     primary_command_spec: ''
     secondary_command_spec: ''
     args: ['']"

Request

ArmorDirective.srv request depends only on ArmorDirectiveReq.msg, whose fields are:

Field arg
client_name optional, node id
reference_name name of the ontology to work on
command command to execute (e.g. ADD, LOAD ...)
primary_command_spec optional, primary command specification (e.g. IND, FILE, ...)
secondary_command_spec optional, secondary command specification
args optional, list of arguments (e.g. list of individuals to add)

ArmorDirective.srv request depends on a list of ArmorDirectiveReq.msg.

The complete list of commands and directives can be found here:

COMMANDS DOCUMENTATION

Response

ArmorDirective.srv request depends only on ArmorDirectiveRes.msg, whose fields are:

Field arg
success bool
exit_code int32
error_description string
is_consistent optional, bool, true if reference is consistent
timeout optional, bool, true if SPARQL query timed out
queried_objects optional, list string, returns list of queried objects
sparql_queried_objects optional, list QueryItem (key-value couples)

ArmorDirective.srv request depends on a list of ArmorDirectiveRes.msg plus the following fields.

Field arg
success bool, false if at least one command fails
is_consistent bool, false if at the end the ontology is inconsistent

NOTE: sparql_queried_objects is used only in QUERY_SPARQL_FORMATTED calls.

Error codes

Field arg
0 Success
1XX Warning
101 Unsupported data type
102 Reference busy
2XX Error
201 Malformed request, unspecified reference name
202 Malformed request, unspecified command
203 Cannot mount client on specified reference
204 Debug only, command defined but not implemented
205 Non-existing command/specification

Publication

More details at:

Contacts

For comment, discussions or support refer to this git repository or contact us at:

armor's People

Contributors

alessiocpt avatar buoncubi avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

armor's Issues

Installation Issue on New Ros Distribution

We experienced issues while installing aRMOR through ROSJava on ROS Noetic and Melodic. Follow these steps to install aRMOR successfully.

  1. Download the rosjava_build_tools on your ROS workspace.
  2. Follow only the second step of the installation guide available in the armor_rds_tutorial.
  3. Download the jdk-8u231-linux-x64.tar.gz archive from ORACLE, and extract it in usr/java/ (create such a path if you don’t have it).
  4. Insert on the .bashrc export JAVA_HOME=/usr/java/jdk1.8.0_231/ and export PATH=$PATH:/usr/java/jdk1.8.0_231/bin, each in a relative line. Close and reopen the terminal to apply these changes. Be sure that the path you set are correct, for instance, it might be export JAVA_HOME=/usr/java/jdk-8u231-linux-x64/jdk1.8.0_231/, and export PATH=$PATH:/usr/java/jdk-8u231-linux-x64/jdk1.8.0_231/bin instead.
  5. Follow the third step of the installation guide used in (2), i.e., the armor_rds_tutorial.
  6. Run catkin_make.
  7. Create the folder org/ros/rosjava_messages in devel/share/maven of your ROS workspace.
  8. Download the armor_msgs.zip, and extract it into the folder previously created, i.e., (7).
  9. Run catkin_make again.

Thanks to Carmine Recchiuto for this solution.

Cannot run CONSTRUCT sparql query in ARMOR

I want to run CONSTRUCT query but it return nothing

I run the following code:
`rosservice call /armor_interface_srv "armor_request:
client_name: 'client3'
reference_name: 'reference3'
command: 'QUERY'
primary_command_spec: 'SPARQL'
secondary_command_spec: 'FORMATTED'
args: ['PREFIX rdf: http://www.w3.org/1999/02/22-rdf-syntax-ns#
PREFIX owl: http://www.w3.org/2002/07/owl#
PREFIX rdfs: http://www.w3.org/2000/01/rdf-schema#
PREFIX xsd: http://www.w3.org/2001/XMLSchema#
PREFIX uni: http://*****.****/university.owl#

CONSTRUCT{
?ind rdf:type uni:High_voltage.
}

WHERE{
?ind rdf:type uni:Voltage.
?ind uni:bat_voltage ?volt.
FILTER(?volt>=25)
}
']" `

Thanks

SPARQL query doesn't provide expected results

Hi There!
This is a SPARQL related issue, but since I've made it work in the Protege SPARQL Query panel, I'm just wondering why the same query doesn't work through ARMOR. The query is not simple, I'm looking for the classes that can take a certain value for a property. To simplify it, let's suppose that I've defined the class Ball with the restriction:

hasSize someValueFrom (Small or Medium)

To retrieve the Classes in the ontology that have in their definitions the possibility to be Small, I do the following:

PREFIX rdfs: http://www.w3.org/2000/01/rdf-schema#
PREFIX rdf: http://www.w3.org/1999/02/22-rdf-syntax-ns#
PREFIX owl: http://www.w3.org/2002/07/owl#
PREFIX : OntologyURI

SELECT ?a

WHERE{
?a rdfs:subClassOf ?c .
?c owl:onProperty :hasSize ;
owl:someValuesFrom ?d .
?d owl:unionOf ?l .
?l rdf:rest*/rdf:first :Small
}

This works in Protege, but with the same Ontology it doesn't through ARMOR. I can also say that the same query but a bit simplified, only with the first three lines in the WHERE section, show the same issue.

I've noticed that ARMOR do the following before performing the query:

ReasonerMonitor@2a4f8e30 : Classifying Ontology_bridge_reference started at: 05/12/17_19:31:02,621 and ends now. Ontology_bridge_reference [Durarion:27926101ns]

Could that change somehow the ontology?

Any help will be appreciated :)

SPARQL query doesn't provide expected results

(I've created a new issue given that the other one was closed. If it's re-opened I could delete this issue :) )

Hi @buoncubi ! Sorry for the late reply, I had to pay attention to other stuff and left this a bit.

I've build a toy ontology aiming to reduce and locate the problem. The ontology has a few classes:

Thing | Size | Small
             | Medium
             | Big
      | Object | Ball
               | Bed

and only one property: hasSize. A Ball hasSize Small or Medium, while a Bed hasSize Big. I've no problems loading it with ARMOR and doing some simple SPARQL queries. For example, asking for all the classes with a superclass:

SPARQL query:
PREFIX  :     <http://www.owl-ontologies.com/toy.owl#>
PREFIX  rdfs: <http://www.w3.org/2000/01/rdf-schema#>
PREFIX  rdf:  <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
PREFIX  owl:  <http://www.w3.org/2002/07/owl#>

SELECT  ?a ?values
WHERE
  { ?a  rdfs:subClassOf  ?c 
  }

[TimeOut:NONE].
-----------------------------------------------------------
| a                                              | values |
===========================================================
| <http://www.owl-ontologies.com/toy.owl#Big>    |        |
| <http://www.w3.org/2002/07/owl#Thing>          |        |
| <http://www.owl-ontologies.com/toy.owl#Small>  |        |
| <http://www.owl-ontologies.com/toy.owl#Object> |        |
| <http://www.owl-ontologies.com/toy.owl#Size>   |        |
| <http://www.owl-ontologies.com/toy.owl#Medium> |        |
| <http://www.owl-ontologies.com/toy.owl#Ball>   |        |
| <http://www.w3.org/2002/07/owl#Nothing>        |        |
| <http://www.owl-ontologies.com/toy.owl#Bed>    |        |
-----------------------------------------------------------

but with a bit further elaborated queries I don't get the expected answers. For example, querying for the objects that have in their definition the hasSize property and the value of that property, I get an empty answer:

SPARQL query:
PREFIX  :     <http://www.owl-ontologies.com/toy.owl#>
PREFIX  rdfs: <http://www.w3.org/2000/01/rdf-schema#>
PREFIX  rdf:  <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
PREFIX  owl:  <http://www.w3.org/2002/07/owl#>

SELECT  ?a ?values
WHERE
  { ?a  rdfs:subClassOf     ?c .
    ?c  owl:onProperty      :hasSize ;
        owl:someValuesFrom  ?values
  }

[TimeOut:NONE].
--------------
| a | values |
==============
--------------

while doing the same query through the SPARQL query panel in Protege I get the expected output:

a:                values:
Bed             Big
Ball            Small or Medium

As commented, I've checked the URIs of concepts in the ontology, and they are all the same.

I've uploaded the ontology just in case you can try it (remove the .txt extension): toy_ARMOR_enabled.owl.txt

Any idea about what could be happening behind scenes?

Thank you for your time!

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.