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

Geosparql tutorial



In this tutorial, we will use the Jena application on a test Owl Schema using Geosparql.

Architecture

In this tutorial, we will specify an architecture with two modules:
jenatutorial
The configuration of the applications will be:
      <applications>
         <application name="jena">
            <deployment>
               <lib url="JenaModule.jar" />
            </deployment>
         </application>
         <application name="userInputs">
            <deployment>
               <lib url="userInputs.jar" />
            </deployment>
            <modules>
               <module name="userInputs" >
                  <interfaces>
                     <requestSend service="owlRequest" timeOut="200ms" />
                  </interfaces>
               </module>
            </modules>
         </application>
      </applications>
We will specify the geo schema for the Jena module properties:
      <properties>
         <application name="jena">
            <module name="jena">
               <moduleArrayGroupProperty key="schemas">
                  <moduleArrayValue>
                     <moduleProperty value="geo" key="name"/>
                     <moduleProperty value="spatialdata.owl" key="owlData"/>
                     <moduleProperty value="my:" key="prefixNS"/>
                     <moduleProperty value="http://example.org/ApplicationSchema#" key="owlNS"/>
                     <moduleProperty key="geosparql" value="true" />
                  </moduleArrayValue>
               </moduleArrayGroupProperty>
            </module>
         </application>
      </properties>
The spatialdata.owl file will contain the Owl Schema.

We have only the same service we alreadyb used in the Jena tutorial:
      <services>
         <requestResponse name="owlRequest" id="30" >
            <request>
               <data name="reqSchema" desc="Schema key" type="string" />
               <data name="query" desc="JENA query" type="string" />
               <data name="responseType" desc="Response Type" type="responseType" />
            </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>
      </services>
And a very simple types definition:
      <types>
         <simpleType name="string" baseType="string" />
         <xmlType name="xml" />
         <enumType name="requestStatus" >
            <enumValue name="VALID" />
            <enumValue name="INVALID" />
            <enumValue name="NO_SCHEMA" />
         </enumType>
         <enumType name="responseType" >
           <enumValue name="FORMATTED" />
           <enumValue name="XML" />
         </enumType>
      </types>
Now we have our configuration: We will have the following filelist.xml file:
      <files>
         <file url="applications.xml" />
         <file url="services.xml" />
         <file url="types.xml" />
         <file url="properties.xml" />
      </files>

Starting the framework

To start the framework, we must start the framework with our filelist.xml file for our configuration:
      java -jar protoframework.jar config=filelist.xml
One Window for the userInputs application will appear:
jenaTutoUserInputs

Sending a Request

We will now send a request for the "geo" Ontology. We need to specify:
  • reqSchema: The Ontology Schema key: geo
  • query: The query
  • responseType: The type of response

Setting the Schema key

Directly type the text "geo" in the reqSchema field.

Setting the query

Click on the button on the query field to edit the query. The text should be for our example:
      SELECT ?f
      WHERE { my:A my:hasExactGeometry ?aGeom .
        ?aGeom geo:asWKT ?aWKT .
        ?f my:hasExactGeometry ?fGeom .
        ?fGeom geo:asWKT ?fWKT .
        FILTER (geof:sfContains(?aWKT, ?fWKT))
      }
We will look for elements that my:A contains. it will include my:A itself, because it obviously includes its own gemoetry.

Invoking the owlRequest Service

Now click on the "Invoke" button to send the request. We will see a Service owlRequest notified message wich indicates that we received a response:
jenatutoInvokedgeo
If we click on the hyperlink, we will go to the content of the returned response for the Service:
jenatutoResponsegeo
We can see that:
  • The "requestStatus" field is "VALID", which means that the request was valid
  • The "schemaKey" field is "geo", as it was the key we used for the request
The response field contains the response from Jena:
      --------------------------------------------
      | f                                        |
      ============================================
      | <http://example.org/ApplicationSchema#F>> |
      | <http://example.org/ApplicationSchema#B> |
      | <http://example.org/ApplicationSchema#A> |
      --------------------------------------------

Sending another Request

Setting the query

Click on the button on the query field to edit the query. The text should be for our example:
      SELECT ?f
      WHERE { my:A my:hasExactGeometry ?aGeom .
        ?aGeom geo:asWKT ?aWKT .
        ?f my:hasExactGeometry ?fGeom .
        ?fGeom geo:asWKT ?fWKT .
        FILTER (geof:sfContains(?aWKT, ?fWKT) &&
        !sameTerm(?aGeom, ?fGeom))
      }
We will look for elements that my:A contains, excluding my:A itself this time.

Invoking the owlRequest Service

Now click on the "Invoke" button to send the request. We will see a Service owlRequest notified message wich indicates that we received a response:
jenatutoInvokedgeo
If we click on the hyperlink, we will go to the content of the returned response for the Service:
jenatutoResponsegeo
We can see that:
  • The "requestStatus" field is "VALID", which means that the request was valid
  • The "schemaKey" field is "geo", as it was the key we used for the request
The response field contains the response from Jena:
      --------------------------------------------
      | f                                        |
      ============================================
      | <http://example.org/ApplicationSchema#F>> |
      | <http://example.org/ApplicationSchema#B> |
      --------------------------------------------

See also


Categories: builtin-applis | tutorials

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