Personal tools

Appendix

Schemata of properties files, RDM files and the ooXmlQL query language.
This tutorial explains how to configure, install and write applications using GRIA's contextualised registry component
Page 5 of 6.

Registry Properties

The registry properties file will have entries like this

#########################################################################
#
# Registry properties specification
#
#########################################################################

# database administrator for installing and configuration of the
registry database
db.admin.user=<admin login name>
db.admin.password=<admin password>
db.admin.group=<group name all registry users belong to, e.g.‘all’>

# namespace of registry domain model
# e.g. 'http://www.gria.org/registrydomainmodel.owl'
registry.domain.model.ns=<namespace> 

# XML database URI
# e.g. 'xmldb:exist://localhost:8080/exist/xmlrpc'
xml.db.uri=<location of eXist> 

# Registration default policy. Used during registration.
# Usage: r|w|u, e.g. for an owner who should have read,
# write and update access: xml.db.perm.owner=rwu
# In general these rules should be applied like this… 

# entities
# owner
xml.db.perm.entity.owner=rwu
# group
xml.db.perm.entity.group=r
# other
xml.db.perm.entity.other= 

# concepts
# owner
xml.db.perm.concept.owner=rwu
# group
xml.db.perm.concept.group=rw
# other
xml.db.perm.concept.other=

Registry Domain Model (RDM)

The RDM can be specified using OWL. The following OWL concepts are currently supported by the registry component:

  • owl:Class (rdfs:label specifies the name of the concept used within the registry, it is therefore always REQUIRED and has to be UNIQUE)
  • rdfs:subClassOf (only simple inheritance is supported)
  • owl:ObjectProperty (rdfs:label specifies the name of the relationship used within the registry, it is therefore always REQUIRED and has to be UNIQUE)
  • owl:inverseOf definition of inverse relationships

 

The following shows an example RDM

 

<rdf:RDF
  xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#"
  xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
  xmlns:owl="http://www.w3.org/2002/07/owl#"
  xmlns:xsd="http://www.w3.org/2001/XMLSchema#">

  <owl:Ontology rdf:about="">
    <rdfs:comment>Registry Domain Model for GRIA Client Management. (C) 2007, University of Southampton IT Innovation Center</rdfs:comment>
    <owl:versionInfo>$Id:RegistryDomainModel.owl,v 1.0 2006/10/31 Uwe Radetzki$</owl:versionInfo>
  </owl:Ontology>

  <!--                                         -->
  <!-- Concepts                                -->
  <!--                                         -->
  <owl:Class rdf:ID="ReferenceAble">
     <rdfs:comment>
        Reference-able elements have a unique reference (EPR)
     </rdfs:comment>
     <rdfs:label>ReferenceAble</rdfs:label>
  </owl:Class>

  <owl:Class rdf:ID="Reference">
    <rdfs:comment>Reference could be an EPR</rdfs:comment>
    <rdfs:label>Reference</rdfs:label>
  </owl:Class>

  <!--                                          -->
  <!-- Relationships between concepts           -->
  <!--                                          -->
  <owl:ObjectProperty rdf:ID="Reference-holdBy-ReferenceAble">
    <rdfs:range rdf:resource="#ReferenceAble"/>
    <rdfs:label>holdBy</rdfs:label>
    <rdfs:domain rdf:resource="#Reference"/>
    <owl:inverseOf rdf:resource="#ReferenceAble-has-Reference"/>
  </owl:ObjectProperty>

  <owl:ObjectProperty rdf:ID="ReferenceAble-has-Reference">
    <rdfs:domain rdf:resource="#ReferenceAble"/>
    <rdfs:label>has</rdfs:label>
    <rdfs:range rdf:resource="#Reference"/>
    <owl:inverseOf rdf:resource="#Reference-holdBy-ReferenceAble"/>
  </owl:ObjectProperty>
</rdf:RDF>

Predefined queries

The following example defines a lookup query that retrieves a document by its identifier. Users can execute this query by specifying the query name (“LookupByDocId”) and the required variables (“docId”).

<queries>
  <query name="LookupByDocId">
     <definition>
       xquery version "1.0";
       for $col in fn:collection("/db/registry/")
          for $doc in util:document-name($col)
             where $doc = $docId
       return $col
     </definition>
     <parameter name="docId"/>
  </query>
</queries>

 

ooXmlQL Specification and Example

The following EBNF grammar specifies sound ooXmlQL queries. Remark: A strange behavior can be observed when using variables where one variable is a prefix of another variable, e.g. $ref and $refAlias. It seems there is a bug in the XQuery processor. Therefore this variable setting should be avoided.

ooXmlQuery    = query.
query         = ‘<query>’ ( queryelements ) ( declareNS)* ‘</query>’.
queryelements = ( select )?
                from
                ( declareVar )*
                ( restriction )?
                ( where )?.
select        = ‘<select>’ ( ‘*’ | xpath expression+ ) ‘</select>’.
declareNS     = ‘<declare name=“’name’”>’ namespace ‘</declare>’.
from          = ‘<from as=“’var‘>’ ( class | setOperation ) ( join )? ‘</from>’.
setOperation  = ‘<union>’ ( class | setOperation )+ ‘</union>’ |
                ‘<intersect>’ ( class | setOperation )+ ‘</intersect>’ |
                ‘<except>’ ( class | setOperation )+ ‘</except>’.
class         = ‘<class name=“’classname’”/>.
join          = ‘<join on=“’relation’” as=“’var’” class=“’class’”>’
                  ( restriction )? ( join )?
                ‘</join>’.
declareVar    = ‘<declare var=“’var’”>xpath expression</declare>’.
where         = ‘<where>xpath or xquery expression</where>’.
restriction   = subquery | and | or | not.
subquery      = ‘<query return=“’relationship’”>’
                   queryelements
                ‘</query>’.
and           = ‘<and>’ restriction+ ‘</and>’
or            = ‘<or>’ restriction+ ‘</or>’.
not           = ‘<not>’ restriction ‘</not>’.

Variables can be used in the following elements of the query:

  • where clause <where>
  • select clause <select>
  • declare variable clause <declareVar>

 

Example ooXmlQL query:

 

<query>
  <select>*</select>
  <declare name="ns1">http://it-innovation.soton.ac.uk/2005/grid</declare>
  <declare name="ns2">http://www.w3.org/2005/08/addressing</declare>
  <from as="$sla">
    <class name="Sla"/>
    <join on="provides" as="$res" class="Resource"/>
  </from>
  <declare var="$min">fn:min($sla//cpu)</declare>
  <declare var="$max">fn:max($sla//cpu)</declare>
  <query return="providedBy">   
     <from class="Resource" as="$res"/>
     <declare var="$avg">fn:avg($res//cpu)</declare>
     <where>
       $res//ns2:Metadata/ns1:type = "uk.ac.soton.ecs.iam.grid.comms.client.RemoteDataService"
     </where>
  </query>
  <where>$sla//cpu = $min or $sla//cpu = $max</where>
</query>
See the GRIA Client section about discovery

for more information about ooXmlQL.