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

Jena application


    1  Overview
    2  Properties
       2.1  Mandatory properties
       2.2  Optional properties
       2.3  imports property
       2.4  debug property
       2.5  Example
    3  Services
       3.1  Provided services
          3.1.1  sendInstance
          3.1.2  Requests queue
          3.1.3  owlRequest
          3.1.4  owlObjectRequest
          3.1.5  requestInfo
       3.2  Subscribed services
          3.2.1  addInstance
          3.2.2  addPropertyToInstance
          3.2.3  addDataPropertyToInstance
          3.2.4  addInverseProperty
          3.2.5  getInstance
    4  Properties
    5  Usage
       5.1  Using SPARQL queries
       5.2  Add instances
       5.3  Add instances properties
    6  Notes
    7  See also

jena
Function invoke the Apache Jena ontology framework
Distribution Jena-bin-.zip
Jar files JenaModule.jar
JenaCommon.jar
Modules jena
Namespace http://dassault-aviation.com/jena

Provided services sendInstance
owlRequest
http://dassault-aviation.com/jena:owlObjectRequest
http://dassault-aviation.com/jena:getProperty
http://dassault-aviation.com/jena:getDataProperty
http://dassault-aviation.com/jena:getProperties
http://dassault-aviation.com/jena:getGeoSPARQLGeometry
http://dassault-aviation.com/jena:setGeoSPARQLGeometry
http://dassault-aviation.com/jena:applyOperations
http://dassault-aviation.com/jena:appliedOperations
http://dassault-aviation.com/jena:getGraph
http://dassault-aviation.com/jena:getStatistics
http://dassault-aviation.com/jena:getObjectStatistics

Required services addInstance
getInstance
addPropertyToInstance
getPropertyOfInstance
addDataPropertyToInstance
updateDataPropertyToInstance
addInverseProperty
saveSchema

Mandatory properties name (per schema)
owlData (per schema)
prefixNS (per schema)
owlNS (per schema)
Optional properties owlSchema (per schema)
defaultNS (per schema)
prefix (per schema)
geosparql (per schema)
owlTime (per schema)
ontologyModel (per schema)
imports
debug
sendRequestInfo
yield
commit
customFunctions

The built-in jena application allows the user to invoke the Apache Jena ontology framework[1]
Apache Jena is an open source Semantic Web framework for Java. It provides an API to extract data from and write to RDF graphs
.

Overview

Main Article: Owl Overview

Apache Jena is an open source Semantic Web framework for Java. It provides an API to extract data from and write to RDF graphs.

See JENA dependencies for the specific dependencies of the Jena module.

Properties

The Jena Application has several properties.

Mandatory properties

The application configuration has the following mandatory property:
  • "schemas": the array of schemas supported by the Jena module. Each schema has the following children properties:
    • "name": the name of the schema as it will be used with the reqSchema key in the requests
    • "prefixNS": the OWL prefix of the schema
    • "owlNS": the OWL namespace of the schema
    • "owlData": the file containing the data. If owlSchema is not present, it will also contain the associated schema
Note that it is possible to separate the schema for the data for each ontology.

Optional properties

The application configuration has the following optional properties:
  • "imports": this property allows to import schemas. See imports property for more information.
  • "debug": this property can be used if debug informations must be shown. The supported values are: See debug property for more information.
    • "false": no debug informations are shown
    • "warning": only warning debug informations are shown
    • "true" or "all": all debug informations are shown
  • "sendRequestInfo": this property specifies if the Jena module must invoke the "requestInfo" service for each Owl request. The supported values are: See requestInfo for more information.
    • "default": the "requestInfo" service will be invoked if there is a subscriber for this service
    • "false": the "requestInfo" service will never be invoked
    • "true": the "requestInfo" service will always be invoked
  • "yield": an int value which allows to wait a number of milliseconds between two operations in the Ontology (default is 0)
  • "commit": true if all transactions are enclosed by a commit / end (default is false)
  • "customFunctions": allows to use custom functions in SPARQL requests. See Jena custom functions for more information
  • "schemas": the array of schemas supported by the Jena module. Each schema has the following children properties:
    • Each schema has the following children optional properties:
      • "owlSchema": the file containing the schema of the ontology (optional)
      • "ontologyModel": the model specification for the ontology (optional). See Jena Ontology model property
      • "geosparql": true if Geosparql must be supported for this schema (optional)
      • "owlTime": true if owl-time must be supported for this schema (optional)

imports property

The "imports" property allows to import schemas. For example here the Dublin Core schema is imported:
      <application name="jena">
         <module name="jena">
            <moduleArrayGroupProperty key="schemas">
               <moduleArrayValue>
                  <moduleProperty key="name" value="sitac"/>
                  <moduleProperty key="owlData" value="19-02-25-SITAC.owl.rdf"/>
                  <moduleProperty key="prefixNS" value="sitac:"/>
                  <moduleProperty key="owlNS" value="http://localhost/SITAC#"/>
               </moduleArrayValue>
            </moduleArrayGroupProperty>
            <moduleProperty key="debug" value="warning"/>
            <moduleArrayProperty key="imports" />
               <value value="dublin_core_elements.rdf"/>
            </moduleArrayProperty>
         </module>
      </application>

debug property

The "debug" property can be used if debug informations must be shown. The supported values are:
  • "false": no debug informations are shown
  • "warning": only warning debug informations are shown
  • "true" or "all": all debug informations are shown


For example:
      <application name="jena">
         <module name="jena">
            <moduleArrayGroupProperty key="schemas">
               <moduleArrayValue>
                  <moduleProperty key="name" value="sitac"/>
                  <moduleProperty key="owlData" value="19-02-25-SITAC.owl.rdf"/>
                  <moduleProperty key="prefixNS" value="sitac:"/>
                  <moduleProperty key="owlNS" value="http://localhost/SITAC#"/>
               </moduleArrayValue>
            </moduleArrayGroupProperty>
            <moduleProperty key="debug" value="warning"/>
         </module>
      </application>
In this case only warnings are shown.

Example

      <application name="jena">
         <module name="jena">
            <moduleArrayGroupProperty key="schemas">
               <moduleArrayValue>
                  <moduleProperty key="name" value="sitac"/>
                  <moduleProperty key="owlData" value="19-02-25-SITAC.owl.rdf"/>
                  <moduleProperty key="prefixNS" value="sitac:"/>
                  <moduleProperty key="ontologyModel" value="OWL_MEM" />
                  <moduleProperty key="owlNS" value="http://localhost/SITAC#"/>
               </moduleArrayValue>
               <moduleArrayValue>
                  <moduleProperty key="name" value="pizza" />
                  <moduleProperty key="owlData" value="pizza.owl.rdf" />
                  <moduleProperty key="prefixNS" value="pizza:" />
                  <moduleProperty key="owlNS" value="http://www.co-ode.org/ontologies/pizza/pizza.owl#" />
               </moduleArrayValue>
            </moduleArrayGroupProperty>
            <moduleProperty key="yield" value="100"/>
         </module>
      </application>

Services

See the following file for the detailed description of the Services.

Note that some services have more datas than those described here, those datas are not used for the moment (only those described here are useful).

jenaarchi

Provided services

The Jena application provides one event Service:
  • sendInstance: provides one event Service which returns a list of instances instance when answering to the getInstance service[2]
    It should be noted that the getInstance and sendInstance services could have been one request-response Service instead
And several request-response Services:
  • sendInstance: provides one event Service which returns a list of instances instance when answering to the getInstance service[3]
    It should be noted that the getInstance and sendInstance services could have been one request-response Service instead
  • http://dassault-aviation.com/jena:applyOperations: this service allows to chain a list of update or creation operations in the underlying database in only one transaction. See Jena operations for more information
  • http://dassault-aviation.com/jena:appliedOperations: this service specifies which element have been created by the previous applyOperations service. See applied operations for more information
  • http://dassault-aviation.com/jena:getGraph: this service allows to get the graph of the ontology structure
  • http://dassault-aviation.com/jena:getStatistics: this service allows to get statistics about the ontology content (number of definition and individuals objects)
  • http://dassault-aviation.com/jena:getObjectStatistics: same as the precedent service, but returns an object rather than a structure
SPARQL requests:
  • owlRequest: this service answers to SPARQL requests to the Jena framework
  • http://dassault-aviation.com/jena:owlObjectRequest: this service answers to SPARQL requests to the Jena framework and return the rsults as objects
See also SPARQL requests.

sendInstance

Upon reception of the getInstance service, the Jena module will invoke this Service to send the list of instances for all the classes defines in the received service.

The datas of the service are:
  • reqSchema: the key of the OWL schema to use for the request, must correspond to the name of one of the owlSchemas in the properties
  • instanceNames: the array specifying the list of instances

Requests queue

All requests are processed in a queue. Note that all owlRequest and owlObjectRequest requests will always be processed prior to any other requests in the queue.

owlRequest

Main Article: owlRequest

The owlRequest Service is a request-response Service Service which answers to SPARQL requests to the Jena framework. The request returns formatted or XML results.

owlObjectRequest

Main Article: owlObjectRequest

The http://dassault-aviation.com/jena:owlObjectRequest service is a request-response Service which answers to SPARQL requests to the Jena framework. The request returns the results as a org.da.protoframework.jena.common.QueryResult object.

requestInfo

The http://dassault-aviation.com/jena:requestInfo service is an event Service which is sent by the Jena module after it has received owlRequest or http://dassault-aviation.com/jena:owlObjectRequest service. This service contains several informations about the request and its processing by the module:
  • reqSchema: The key of the OWL schema used for the request
  • request: The full SPARQL request string as used by the Jena module, including the prefix
  • requestStatus: The return status of the request
  • errorMessage: The error message if the request was not valid
This service can be useful if you produce an invalid request (for example with the SparqlRequest utility), but you don't know why it is invalid.

The "sendRequestInfo" property specifies if the Jena module must invoke the "requestInfo" service for each Owl request. The supported values are:
  • "default": the "requestInfo" service will be invoked if there is a subscriber for this service
  • "false": the "requestInfo" service will never be invoked
  • "true": the "requestInfo" service will always be invoked

Subscribed services

The Jena application subscribes to five event Services:
  • addInstance: add an instance to an Ontology
  • addPropertyToInstance: add a property to an instance to an Ontology
  • addDataPropertyToInstance: add a Data property to an instance to an Ontology
  • addInverseProperty: allows to add an inverse property to an Ontology
  • getInstance: allows to ask for a list of instances. Upon reception of this service, the Jena module will invoke the sendInstance service[3]
    It should be noted that the getInstance and sendInstance services could have been one request-response Service instead
  • saveSchema: allows to save the content of the ontology to a file

addInstance

The addInstance Service is an event Service Service which allows to add an instance.

The datas of the service are:
  • reqSchema: the key of the OWL schema to use for the request, must correspond to the name of one of the owlSchemas in the properties
  • instanceName: the name of the instance to create
  • parentName: the name of the parent class of the instance

addPropertyToInstance

The addPropertyToInstance Service is an event Service Service which allows to add a property to an instance.

The datas of the service are:
  • reqSchema: the key of the OWL schema to use for the request, must correspond to the name of one of the owlSchemas in the properties
  • instanceSubjectName: the name of the instance for which to add the property
  • propertyName: the name of the property
  • propertyValue: the value of the property

addDataPropertyToInstance

The addDataPropertyToInstance Service is an event Service Service which allows to add a Data property to an instance.

The datas of the service are:
  • reqSchema: the key of the OWL schema to use for the request, must correspond to the name of one of the owlSchemas in the properties
  • instanceSubjectName: the name of the instance for which to add the property
  • dataPropertyName: the name of the data property
  • dataPropertyValue: the value of the data property

addInverseProperty

The addInverseProperty Service is an event Service Service which allows to add the inverse of a property.

The datas of the service are:
  • reqSchema: the key of the OWL schema to use for the request, must correspond to the name of one of the owlSchemas in the properties
  • property1: the name of the existing property
  • property2: the name of the inverse property to create relative to the existing property

getInstance

The getInstance Service allows to ask for a list of instances for a list of classes. Upon reception of this service, the Jena module will invoke the sendInstance Service to send the list of instances.

The datas of the service are:
  • reqSchema: the key of the OWL schema to use for the request, must correspond to the name of one of the owlSchemas in the properties
  • instanceType: the array specifying the list of classes

Properties


The Jena application has several mandatory and optional properties, allowing to define one or several ontologies. For each ontology we have:
  • name: (mandatory) the key of the Schema, to be used in the requests and responses
  • owlData: (mandatory) the files for the RDF data
  • owlSchema: (optional) the files for the OWL schema[4]
    The owlSchema is not mandatory, by default the Jena framework will look for both the definition and the data in the owlData file. See also #separating the schema and the data for an ontology
  • prefixNS: (mandatory) the prefixes for the OWL query
  • owlNS: (mandatory) the namespaces for the OWL query
  • defaultNS: (optional) the default namespace
  • prefix: (optional) an additional array of prefix / namespaces
Note that all these properties are defined in an array group.

Usage

To use the Jena module, the Client module should subscribe to at least one of the owlRequest service.

Using SPARQL queries

To use SPARQL queries, the Client module should subscribe to the owlRequest service.

For example:
      <module name="userInputs" id="1" >
         <interfaces>
            <requestSend service="owlRequest" timeOut="300ms" />
         </interfaces>
      </module>


jenaarchi2
The Client module should send a request with the following datas:
  • reqSchema: The Owl Schema key
  • query: The Owl query
  • responseType: The desired response type, which can be:
    • "FORMATTED": formatted text
    • "XML": XML


The Jena module will provide a response with the following datas:
  • respSchema: The Owl Schema key which was used for the request
  • response: The Owl response
  • requestStatus: The Owl response status. The values can be:
    • VALID: valid request
    • NO_SCHEMA: no Schema found with the specified Schema key
    • INVALID: invalid request
Note that the request itself can be generated using the SparqlRequest utility.

Add instances

To add instances, the Client module should subscribe to the addInstance service.

For example:
      <module name="userInputs" id="1" >
         <interfaces>
            <eventSend service="addInstance" />
         </interfaces>
      </module>

Add instances properties

To add instances properties, the Client module should subscribe to the addPropertyToInstance service.

For example:
      <module name="userInputs" id="1" >
         <interfaces>
            <eventSend service="addPropertyToInstance" />
         </interfaces>
      </module>

Notes

  1. ^ Apache Jena is an open source Semantic Web framework for Java. It provides an API to extract data from and write to RDF graphs
  2. ^ It should be noted that the getInstance and sendInstance services could have been one request-response Service instead
  3. ^ [1] [2] It should be noted that the getInstance and sendInstance services could have been one request-response Service instead
  4. ^ The owlSchema is not mandatory, by default the Jena framework will look for both the definition and the data in the owlData file. See also #separating the schema and the data for an ontology

See also


Categories: builtin-applis

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