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

Jena namespace declarations



The Jena module has several mandatory and optional properties, allowing to define the namespaces and their associated prefix. For each ontology we have:
  • 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.

Overview

You don't need to add the prefix declarations for your SPARQL requests. The module will automatically add these declarations at the beginning of your requests, depending on the module namespace properties.

For example, for the following properties:
      <properties>
         <application name="jena" >
            <module name="jena" >
               <moduleArrayGroupProperty key="schemas">
                  <moduleArrayValue>
                     <moduleProperty key="name" value="pizza" />
                     <moduleProperty key="owlSchema" value="pizza.owl" />
                     <moduleProperty key="prefixNS" value="pizza:" />
                     <moduleProperty key="owlNS" value="http://www.co-ode.org/ontologies/pizza/pizza.owl#" />
                  </moduleArrayValue>
               </moduleArrayGroupProperty>
            </module>
         </application>
      </properties>
If you set the following owlRequest query:
      SELECT ?pizza 
      WHERE {
        ?pizza a owl:Class ;
        rdfs:subClassOf ?restriction.
        ?restriction owl:onProperty pizza:hasTopping ;
        owl:someValuesFrom pizza:PeperoniSausageTopping
      }
The effective request sent to the engine will be:
      prefix pizza: <http://www.co-ode.org/ontologies/pizza/pizza.owl#>
      prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
      prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#>
      prefix xsd: <http://www.w3.org/2001/XMLSchema#>
      prefix fn: <http://www.w3.org/2005/xpath-functions#>
      prefix owl: <http://www.w3.org/2002/07/owl#>
      SELECT ?pizza        WHERE {         ?pizza a owl:Class ;         rdfs:subClassOf ?restriction.         ?restriction owl:onProperty pizza:hasTopping ;         owl:someValuesFrom pizza:PeperoniSausageTopping       }      S   ELECT ?pizza 
      WHERE {
        ?      prefix owl: <http://www.w3.org/2002/07/o      prefix fn: <http://www.w3.org/2005/      prefix xsd: <http://www.w3.org/2001/XMLSche      prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#>      prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>

Setting the default namespace

By default no default namespace is added to the requests[1] . To add a default namespace, you must specify the defaultNS property. For example, with the following properties declaration:
      <properties>
         <application name="jena" >
            <module name="jena" >
               <moduleArrayGroupProperty key="schemas">
                  <moduleArrayValue>
                     <moduleProperty key="name" value="pizza" />
                     <moduleProperty key="owlSchema" value="pizza.owl" />
                     <moduleProperty key="prefixNS" value="pizza:" />
                     <moduleProperty key="defaultNS" value="http://www.co-ode.org/ontologies/pizza/pizza.owl#" />
                     <moduleProperty key="owlNS" value="http://www.co-ode.org/ontologies/pizza/pizza.owl#" />
                  </moduleArrayValue>
               </moduleArrayGroupProperty>
            </module>
         </application>
      </properties>
If you set the following owlRequest query:
      SELECT ?pizza 
      WHERE {
        ?pizza a owl:Class ;
        rdfs:subClassOf ?restriction.
        ?restriction owl:onProperty pizza:hasTopping ;
        owl:someValuesFrom pizza:PeperoniSausageTopping
      }
The effective request sent to the engine will be:
      prefix pizza: <http://www.co-ode.org/ontologies/pizza/pizza.owl#>
      prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
      prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#>
      prefix xsd: <http://www.w3.org/2001/XMLSchema#>
      prefix fn: <http://www.w3.org/2005/xpath-functions#>
      prefix owl: <http://www.w3.org/2002/07/owl#>
      prefix xmlns: <http://www.co-ode.org/ontologies/pizza/pizza.owl#>
      SELECT ?pizza        WHERE {         ?pizza a owl:Class ;         rdfs:subClassOf ?restriction.         ?restriction owl:onProperty pizza:hasTopping ;         owl:someValuesFrom pizza:PeperoniSausageTopping       }      S   ELECT ?pizza 
      WHERE {
        ?pizza a owl:Class ;
       prefix xmlns: <http://www.co-ode.org/o      prefix owl: <http://www.w3.org/2002/07/o      prefix fn: <http://www.w3.org/2005/      prefix xsd: <http://www.w3.org/2001/XMLSche      prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#>      prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>

Handling the Geosparql namespace


If you support Geosparql by setting true for the geosparql property, the namespaces associated with the Geosparql vocabulary will be added:
      prefix geo: <http://www.opengis.net/ont/geosparql#>
      prefix unit: <http://qudt.org/vocab/unit#>
      prefix uom: <http://www.opengis.net/def/uom/OGC/1.0/#>
      prefix geof: <http://www.opengis.net/def/function/geosparql/">             prefix geof: <http://www.opengis.net/def/function/g      prefix uom: <http://www.opengis.net      prefix unit: <http://qudt.org/vocab/uni

Handling the owlTime namespace


If you support owl-time by setting true for the owlTime property, the namespace associated with the owl-time vocabulary will be added:
      prefix time: <http://www.w3.org/2006/time#> 

Adding additional namespaces

It is possible to add additional namespaces by setting the prefix property. For example, with the following properties declaration:
      <properties>
         <application name="jena" >
            <module name="jena" >
               <moduleArrayGroupProperty key="schemas">
                  <moduleArrayValue>
                     <moduleProperty key="name" value="pizza" />
                     <moduleProperty key="owlSchema" value="pizza.owl" />
                     <moduleProperty key="prefixNS" value="pizza:" />
                     <moduleArrayProperty key="prefix">
                        <value value="p1 http://my/prefix/prefix1.owl#" />
                        <value value="p2 http://my/prefix/prefix2.owl#" />
                     </moduleArrayProperty>
                  </moduleArrayValue>
               </moduleArrayGroupProperty>
            </module>
         </application>
      </properties>
If you set the following owlRequest query:
      SELECT ?pizza 
      WHERE {
        ?pizza a owl:Class ;
        rdfs:subClassOf ?restriction.
        ?restriction owl:onProperty pizza:hasTopping ;
        owl:someValuesFrom pizza:PeperoniSausageTopping
      }
The effective request sent to the engine will be:
      prefix pizza: <http://www.co-ode.org/ontologies/pizza/pizza.owl#>
      prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
      prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#>
      prefix xsd: <http://www.w3.org/2001/XMLSchema#>
      prefix fn: <http://www.w3.org/2005/xpath-functions#>
      prefix owl: <http://www.w3.org/2002/07/owl#>
      prefix p1: <http://my/prefix/prefix1.owl#>
      prefix p2: <http://my/prefix/prefix2.owl#>
      SELECT ?pizza        WHERE {         ?pizza a owl:Class ;         rdfs:subClassOf ?restriction.         ?restriction owl:onProperty pizza:hasTopping ;         owl:someValuesFrom pizza:PeperoniSausageTopping       }      S   ELECT ?pizza 
      WHERE {
             prefix p2: <http://my/prefix/prefix2      prefix p1: <http://my/prefix/prefix1.o      prefix owl: <http://www.w3.org/2002/07/o      prefix fn: <http://www.w3.org/2005/      prefix xsd: <http://www.w3.org/2001/XMLSche      prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#>      prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>

Notes

See also


Categories: builtin-applis

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