Home
Categories
Dictionary
Glossary
Download
Project Details
Changes Log
What Links Here
FAQ
License

Map ontology tutorial



The map ontology tutorial present the usage of a tacticalEnv Application, a UA application, and a Jena module, to create a synthetic map for a business Jet aircraft, and allow to ask requests on an ontology associated with the aircraft and its environment.

The source code and configuration of this tutorial can be found here: sourceforge.net/projects/protoframeworksamples/

Use case

In this tutorial, we will create a synthetic map for a business Jet aircraft, and show in this Map: We will also add two buttons to change the range of the map.
syntheticmap2
To create the objects in the Map, we will use a tacticalEnv Application. The synthetic map itself will be managed by a UA application.

The ontology should allow us to answer requests such as[2]
Of course in this example we will ask the requests using the SPARQL request language, not in plain English
:
  • How many alerts are currently active?
  • What is the list of alerts?
  • What is the list of Waypoints?
  • What is the distance of the closest landing Waypoint?

Architecture

Overview

We have the following modules:
mapOntologyarchi

Specify the modules interfaces

First you must put the tacticalEnvCommon.jar and the JenaCommon.jar Jar files in the global deployment because this library must be shared between the tacticalEnv Application, the Jena module, and the UA application. If you don't do that, you would encounter a ClassCast exception[3] :
      <applications>   
         <deployment>
            <lib url="tacticalEnvCommon.jar" />  
            <lib url="JenaCommon.jar" />     	  
         </deployment>   
      ...
      </applications>

Tactical Environment

The tactical environment scenario contains the following elements: See the definition of the environment.

AlertEngine module

The AlertEngine module is responsible to:
  • Send creation or deletions of alerts depending on the user clicking on an alert list

mapOntologyalerts
The module provides the following service:
      <event name="alert">  
         <data name="alert" type="alert" desc="the alert"/> 
         <data name="status" type="alertStatus" desc="the alert status"/>  
      </event>
The alertStatus types have the following definition:
      <enumType name="alertType" >  
         <enumValue name="WARNING" />
         <enumValue name="CAUTION" />               
         <enumValue name="ADVISORY" />                      
      </enumType>    
      <enumType name="alertStatus" >  
         <enumValue name="NEW" />
         <enumValue name="REMOVED" />                                
      </enumType>        
      <structType name="alert">
         <field name="number" type="int" />
         <field name="type" type="alertType" />
         <field name="content" type="string" />       
      </structType>
Each time the user clicks on a checkbox in front of an alert:
  • If the checkbox is selected, the alert service is sent with the status set to NEW
  • If the checkbox is unselected, the alert service is sent with the status set to REMOVED

UA application


The UA application is responsible to:
  • Show the elements of the tactical environment (flightplans, waypoints, and aircraft
  • Handle the Zoom In / Zoom Out on the Map, and the change of the map center
The code is very similar to the code used for the synthetic map tutorial.

The UA Application has the following module configuration:
      <application name="uaappli">
         <deployment>
            <lib url="UAApplication.jar" />
            <lib url="UAAppliHelper.jar" />
         </deployment>
         <modules>
            <module name="uaappli">
               <interfaces>
                  <eventReceived service="worldConfig" uri="http://dassault-aviation.com/tacticalenv"/>
                  <eventReceived service="flightplansModel" uri="http://dassault-aviation.com/tacticalenv"/>
                  <eventReceived service="waypointsModel" uri="http://dassault-aviation.com/tacticalenv"/>  
                  <subscribe service="aircraftsModel" uri="http://dassault-aviation.com/tacticalenv"/>    
               </interfaces>
            </module>
         </modules>
      </application>
It will be notified from the following services:
  • The worldConfig service to set the center of the map
  • The flightplansModel and waypointsModel services to set the flightplan and the Waypoints
  • The aircraftsModel service to update the position of the Aircraft

fillOntology module

Main Article: fillOntology module

The fillOntology module is responsible to:
  • Fill the Ontology with the flightplan, and the waypoints
  • Fill and update the Ontology with the aircraft position
  • Update the Ontology depending on the notification of the alert service

Specifying the properties

We have the following properties file:
      <properties>   
         <application name="jena">
            <module name="jena">
               <moduleArrayGroupProperty key="schemas">
                  <moduleArrayValue>
                     <moduleProperty key="name" value="inav" />
                     <moduleProperty key="owlData" value="MapGeoSparql.owl.rdf" />
                     <moduleProperty key="prefixNS" value="inav:" />
                     <moduleProperty key="owlNS" value="http://localhost/INAV#" />
                     <moduleProperty key="geosparql" value="true" />
                  </moduleArrayValue>
               </moduleArrayGroupProperty>
               <moduleProperty key="debug" value="false" />
               <moduleProperty key="commit" value="true" />
            </module>
         </application>
   
         <application name="uaappli" >
            <module name="uaappli" >
               <moduleProperty key="uaImpl" value="InavUI.jar" />
               <moduleProperty key="uaPath" value="org.da.arinc.syntheticmap.InavUI" />
               <moduleProperty key="a661Config" value="arinc/arincserver.properties" />
               <moduleProperty key="includeServer" value="true" />
            </module>
         </application>	
   
         <application name="alertEngine" >
            <module name="alertEngine" >
               <moduleProperty key="alertList" value="alerts.xml" />
            </module>
         </application>     
	
         <application name="tacticalenv">
            <module name="tacticalenv">
               <moduleProperty key="scenario" value="tacticalEnv.xml" />
               <moduleProperty key="activate" value="true" />
               <moduleProperty key="updatePeriod" value="1s" />
            </module>
         </application>       
      </properties>

Starting the framework

We start the framework with the filelist.xml file for our configuration, as for all our other tutorials:
      java -jar protoframework.jar config=filelist.xml
As you see, in this configuration, the Aircraft does move. Now we can ask SPARQL requests about the environment using the userInputs application interface.

Several windows will appear:

Asking requests

The owlRequest service has the following datas:
      <requestResponse name="owlRequest">
         <request>
            <data name="reqSchema" desc="Schema key" type="string" />
            <data name="query" desc="JENA query" type="string" />
            <data name="responseType" desc="Response Type" type="ontologyResponseType" />
         </request>
         <response>
            <data name="respSchema" desc="Schema key" type="string" />
            <data name="response" desc="JENA query response" type="string" />
            <data name="xmlResponse" desc="JENA XML query response" type="xml" />
            <data name="requestStatus" desc="Request status" type="requestStatus" />
         </response>
      </requestResponse>
You can send requests (ie queries) with the userInputs application. Try several queries which are defined in the queries sub-directory. The reqSchema data must be set to inav because it is the key of our schema in the properties.

Waypoints requests

The following request returns the list of Waypoints:
      SELECT ?label
      WHERE { 
         ?wpt rdf:type inav:Waypoint .
         ?wpt inav:Label ?label .
      }      
You will have the following response in the response output data:
      -----------
      | label   |
      ===========
      | "ATT1"  |
      | "WPT7"  |
      | "WPT10" |
      | "WPT9"  |
      | "WPT4"  |
      | "ATT2"  |
      | "WPT11" |
      | "WPT8"  |
      | "WPT6"  |
      -----------      
The following request returns the list of Waypoints which are in the FlightPlan:
      SELECT ?label
      WHERE { 
         ?wpt rdf:type inav:Waypoint .
         ?fp rdf:type inav:FlightPlan .
         ?wpt inav:isWaypointFrom ?fp .
         ?wpt inav:Label ?label .
      }
You will have the following response in the response output data:
      -----------
      | label   |
      ===========
      | "WPT7"  |
      | "WPT9"  |
      | "WPT11" |
      | "WPT8"  |
      | "WPT6"  |
      -----------     
The following request returns the nearest ATT Waypoint and its distance:
      SELECT ?label ?distance
      WHERE {
         ?wpt rdf:type inav:Waypoint .
         ?wpt inav:Label ?label .    
         ?wpt inav:hasWaypointType <http://localhost/INAV#ATT> .
         ?ac  rdf:type inav:Aircraft .          ?ac  inav:Label "falcon" .          ?wpt inav:hasExactGeometry ?auto_2 .          ?auto_2 inav:asWKT ?auto_3 .          ?ac inav:hasExactGeometry ?auto_4 .          ?auto_4 inav:asWKT ?auto_5 .          BIND (geof:distance(?auto_3, ?auto_5, <http://www.opengis.net/def/uom/OGC/1.0/nauticalMile>) as ?distance)       }       ORDER BY ASC( ?distance )       LIMIT 1?   ac  rdf:type inav:Aircraft .
         ?ac 
You will have the following response in the response output data:
      --------------------------------
      | label  | distance            |
      ================================
      | "ATT1" | 42.03500329415974e0 |
      --------------------------------
This last SPARQL query is a bit more complex than the others:
  • We get the Waypoint individuals which are of the ATT type
  • We get the Aircraft
  • We get the geometries of both the Waypoint and the Aircraft
  • We compute the distance between the Waypoint geometry and the Aircraft geometry
  • We order the results by ascending distance and keep only the first one (which is the closest)

Alerts requests

The following request returns the list of Alerts:
      SELECT ?number ?type
      WHERE { 
         ?alarm rdf:type inav:Alarm .
         ?alarm inav:AlarmNumber ?number .
         ?alarm inav:hasAlarmType ?type .
      }    
To have a non empty result you need to check some Alerts in the AlertEngine GUI.

You will have for example the following response in the response output data:
      -----------------------------------------------
      | number | type                               |
      ===============================================
      | "5"    | <http://localhost/INAV#AmberAlarm> |
      | "7"    | <http://localhost/INAV#RedAlarm>   |
      | "3"    | <http://localhost/INAV#AmberAlarm> |
      -----------------------------------------------

Going further

The next tutorial uses the same Ontology as this one, but the requests are built using the SPARQL request creation utility, and the results are returned as objects rather than text.

Notes

  1. ^ See Flight plan
  2. ^ Of course in this example we will ask the requests using the SPARQL request language, not in plain English
  3. ^ See sharing libraries between applications

See also


Categories: tutorials

Copyright 2017-2020 Dassault Aviation. All Rights Reserved. Documentation and source under the LGPL v3 licence