[659] | 1 | .. _process-profiles: |
---|
| 2 | |
---|
| 3 | Process profiles registry |
---|
[696] | 4 | ========================= |
---|
[659] | 5 | |
---|
| 6 | WPS Services belonging to the same Services provider often share the |
---|
| 7 | same inputs and outputs. In such a case, every :ref:`ZCFG |
---|
| 8 | <services-zcfg>` file would contain the same metadata information and |
---|
| 9 | this may be a waste of time to write them all. |
---|
| 10 | |
---|
[696] | 11 | :ref:`ZOO-Kernel <kernel_index>` is able to handle metadata |
---|
| 12 | inheritance from `rev. 607 |
---|
| 13 | <http://www.zoo-project.org/trac/changeset/607>`__, and this solves |
---|
| 14 | the issue of writing many ZCFG with same input and output. A registry |
---|
[698] | 15 | can be loaded by the ZOO-Kernel (before any other ZCFG files) and |
---|
| 16 | contain a set of Process Profiles organized in hierarchic levels |
---|
| 17 | according to the following rules: |
---|
[659] | 18 | |
---|
[698] | 19 | * *Concept*: The higher level in the hierarchy. *Concepts* are basic |
---|
| 20 | text files containing an abstract description of a WPS Service |
---|
| 21 | (see `the OGC definition |
---|
| 22 | <http://docs.opengeospatial.org/is/14-065/14-065.html#33>`_ for |
---|
| 23 | more details). |
---|
| 24 | * *Generic*: A *Generic* profile can make reference to |
---|
| 25 | *Concepts*. It defines inputs and outputs without data format or |
---|
| 26 | maximum size limitation (see `the OGC definition |
---|
| 27 | <http://docs.opengeospatial.org/is/14-065/14-065.html#34>`_ for |
---|
| 28 | more details). |
---|
[659] | 29 | * *Implementation*: An *Implementation* profile can inherit from a |
---|
[698] | 30 | generic profile and make reference to concepts (see `the OGC definition |
---|
| 31 | <http://docs.opengeospatial.org/is/14-065/14-065.html#35>`_ for |
---|
| 32 | more details). It contains all the metadata information about a |
---|
| 33 | particular WPS Service (see :ref:`ZCFG reference <services-zcfg>` |
---|
| 34 | for more information). |
---|
[659] | 35 | |
---|
[698] | 36 | Both *Generic* and *Implementation* process profiles are created from |
---|
| 37 | :ref:`ZCFG <services-zcfg>` files and stored in the registry |
---|
| 38 | sub-directories according to their level (*Concept*, *Generic* or |
---|
| 39 | *Implementation*). |
---|
[659] | 40 | |
---|
| 41 | To activate the registry, you have to add a ``registry`` key to the |
---|
| 42 | ``[main]`` section of your ``main.cfg`` file, and set its value to the |
---|
[698] | 43 | directory path used to store the profile ZCFG files. Please see |
---|
| 44 | :ref:`install_gfr` for more details about the other services and |
---|
| 45 | parameters required. |
---|
[659] | 46 | |
---|
[698] | 47 | .. note:: |
---|
| 48 | Even if the profile registry was first introduced in WPS 2.0.0, it |
---|
| 49 | can be also used in the same way for WPS 1.0.0 Services. |
---|
[659] | 50 | |
---|
[698] | 51 | |
---|
| 52 | |
---|
| 53 | |
---|
[659] | 54 | Generic Process Profile |
---|
| 55 | ----------------------- |
---|
| 56 | |
---|
| 57 | A Generic Process Profile is a ZCFG file located in the ``generic`` |
---|
| 58 | sub-directory, it defines `main metadata information |
---|
| 59 | <zcfg-reference.html#main-metadata-information>`__, inputs and outputs |
---|
| 60 | name, basic metadata and multiplicity. It can make reference to a |
---|
| 61 | concept by defining a ``concept`` key in the `main metadata |
---|
| 62 | information <zcfg-reference.html#main-metadata-information>`__ part. |
---|
| 63 | |
---|
| 64 | You can find below the `GO.zcfg` file, a typical Generic Process |
---|
| 65 | Profile for Generic Geographic Operation, taking one InputPolygon |
---|
| 66 | input parameter and returning a result named Result, it make reference |
---|
| 67 | to the ``GOC`` concept: |
---|
| 68 | |
---|
| 69 | .. code-block:: none |
---|
| 70 | :linenos: |
---|
| 71 | |
---|
| 72 | [GO] |
---|
| 73 | Title = Geographic Operation |
---|
| 74 | Abstract = Geographic Operation on exactly one input, returning one output |
---|
| 75 | concept = GOC |
---|
| 76 | level = generic |
---|
| 77 | statusSupported = true |
---|
| 78 | storeSupported = true |
---|
| 79 | <DataInputs> |
---|
| 80 | [InputPolygon] |
---|
| 81 | Title = the geographic data |
---|
| 82 | Abstract = the geographic data to run geographipc operation |
---|
| 83 | minOccurs = 1 |
---|
| 84 | maxOccurs = 1 |
---|
| 85 | </DataInputs> |
---|
| 86 | <DataOutputs> |
---|
| 87 | [Result] |
---|
| 88 | Title = the resulting data |
---|
| 89 | Abstract = the resulting data after processing the operation |
---|
| 90 | </DataOutputs> |
---|
| 91 | |
---|
| 92 | |
---|
| 93 | .. Note:: if you need to reference more than one concept, you should |
---|
| 94 | separate their names with a comma (ie. concept = GO,GB), |
---|
| 95 | |
---|
| 96 | Process Implementation Profile |
---|
| 97 | ------------------------------ |
---|
| 98 | |
---|
| 99 | A Process Implementation Profile is similar to a `ZCFG file |
---|
| 100 | <zcfg-reference.html>`__ located in the `implementation` |
---|
| 101 | sub-directory, it defines (or inherit from its parent) all the |
---|
| 102 | properties of a `Generic Process Profile <#generic-process-profile>`__ |
---|
| 103 | and specify `Data Format <zcfg-reference.html#type-of-data-nodes>`__ |
---|
| 104 | for both inputs and outputs. It can make reference to a concept by |
---|
| 105 | defining a ``concept`` key in the `main metadata information |
---|
| 106 | <zcfg-reference.html#main-metadata-information>`__ part. |
---|
| 107 | |
---|
| 108 | You can find below the `VectorOperation.zcfg` file, a typical Process |
---|
| 109 | Implementation Profile for Vector Geographic Operation, it inherit |
---|
| 110 | from the `GP generic profile <#generic-process-profile>`__: |
---|
| 111 | |
---|
| 112 | .. code-block:: none |
---|
| 113 | :linenos: |
---|
| 114 | |
---|
| 115 | [VectorOperation] |
---|
| 116 | Title = Vector Geographic Operation |
---|
| 117 | Abstract = Apply a Vector Geographic Operation on a features collection and return the resulting features collection |
---|
| 118 | extend = GO |
---|
| 119 | level = profile |
---|
| 120 | <DataInputs> |
---|
| 121 | [InputPolygon] |
---|
| 122 | Title = the vector data |
---|
| 123 | Abstract = the vector data to run geographic operation |
---|
| 124 | <ComplexData> |
---|
| 125 | <Default> |
---|
| 126 | mimeType = text/xml |
---|
| 127 | encoding = UTF-8 |
---|
| 128 | schema = http://fooa/gml/3.1.0/polygon.xsd |
---|
| 129 | </Default> |
---|
| 130 | <Supported> |
---|
| 131 | mimeType = application/json |
---|
| 132 | encoding = UTF-8 |
---|
| 133 | extension = js |
---|
| 134 | </Supported> |
---|
| 135 | </DataInputs> |
---|
| 136 | <DataOutputs> |
---|
| 137 | [Result] |
---|
| 138 | Title = the resulting data |
---|
| 139 | Abstract = the resulting geographic data after processing the operation |
---|
| 140 | <ComplexData> |
---|
| 141 | <Default> |
---|
| 142 | mimeType = text/xml |
---|
| 143 | encoding = UTF-8 |
---|
| 144 | schema = http://fooa/gml/3.1.0/polygon.xsd |
---|
| 145 | </Default> |
---|
| 146 | <Supported> |
---|
| 147 | mimeType = application/json |
---|
| 148 | encoding = UTF-8 |
---|
| 149 | extension = js |
---|
| 150 | </Supported> |
---|
| 151 | </ComplexData> |
---|
| 152 | </DataOutputs> |
---|
| 153 | |
---|
| 154 | |
---|
| 155 | ZCFG inheritance |
---|
| 156 | ---------------------------------- |
---|
| 157 | |
---|
| 158 | For the ZCFG files at the service level, you can inherit the metadata |
---|
| 159 | from a Process Implementation Profile available in the registry. As |
---|
| 160 | before, you simply need to add a ``extend`` key refering the ZCFG you |
---|
| 161 | want to inherit from and a ``level`` key taking the `ìmplementation`` |
---|
| 162 | value to your main metadata informations. |
---|
| 163 | |
---|
| 164 | So, for example, the original `ConvexHull.zcfg |
---|
| 165 | <http://www.zoo-project.org/trac/browser/trunk/zoo-project/zoo-services/ogr/base-vect-ops/cgi-env/ConvexHull.zcfg?rev=491>`__ |
---|
| 166 | may be rewritten as: |
---|
| 167 | |
---|
| 168 | .. code-block:: none |
---|
| 169 | :linenos: |
---|
| 170 | |
---|
| 171 | [ConvexHull] |
---|
| 172 | Title = Compute convex hull. |
---|
| 173 | Abstract = Return a feature collection that represents the convex hull of each geometry from the input collection. |
---|
| 174 | serviceProvider = ogr_service.zo |
---|
| 175 | serviceType = C |
---|
| 176 | extend = VectorOperation |
---|
| 177 | level = implementation |
---|
| 178 | |
---|
| 179 | Now, suppose that your service is able to return the result in KML |
---|
| 180 | format, then you may write the following: |
---|
| 181 | |
---|
| 182 | .. code-block:: none |
---|
| 183 | :linenos: |
---|
| 184 | |
---|
| 185 | [ConvexHull] |
---|
| 186 | Title = Compute convex hull. |
---|
| 187 | Abstract = Return a feature collection that represents the convex hull of each geometry from the input collection. |
---|
| 188 | serviceProvider = ogr_service.zo |
---|
| 189 | serviceType = C |
---|
| 190 | extend = VectorOperation |
---|
| 191 | level = implementation |
---|
| 192 | <DataOutputs> |
---|
| 193 | [Result] |
---|
| 194 | <Supported> |
---|
| 195 | mimeType = application/vnd.google-earth.kml+xml |
---|
| 196 | encoding = utf-8 |
---|
| 197 | </Supported> |
---|
| 198 | </DataOutputs> |
---|
[696] | 199 | |
---|
[698] | 200 | .. _install_gfr: |
---|
| 201 | |
---|
| 202 | Setup registry browser |
---|
| 203 | ---------------------- |
---|
| 204 | |
---|
| 205 | In the ``zoo-project/zoo-services/utils/registry`` you can find the |
---|
| 206 | source code and the ``Makefile`` required to build the Registry Browser |
---|
| 207 | Services Provider. To build and install this service, use the |
---|
| 208 | following comands: |
---|
| 209 | |
---|
| 210 | .. code:: |
---|
| 211 | |
---|
| 212 | cd zoo-project/zoo-services/utils/registry |
---|
| 213 | make |
---|
| 214 | cp cgi-env/* /usr/lib/cgi-bin |
---|
| 215 | |
---|
| 216 | |
---|
| 217 | To have valid |
---|
| 218 | ``href`` in the metadata children of a ``wps:Process``, you have to |
---|
| 219 | define the ``registryUrl`` to point to the path to browse the |
---|
| 220 | registry. For this you have two different options, the first one is to |
---|
| 221 | install the ``GetFromRegistry`` ZOO-Service and to use a WPS 1.0.0 |
---|
| 222 | Execute request as ``registryUrl`` to dynamically generate `Process |
---|
| 223 | Concept <http://docs.opengeospatial.org/is/14-065/14-065.html#33>`__, |
---|
| 224 | `Generic Process Profile |
---|
| 225 | <http://docs.opengeospatial.org/is/14-065/14-065.html#34>`__ and |
---|
| 226 | `Process Implementation Profile |
---|
| 227 | <http://docs.opengeospatial.org/is/14-065/14-065.html#35>`__. |
---|
| 228 | You also have to add a ``registryUrl`` to the ``[main]`` section to |
---|
| 229 | inform the ZOO-Kernel that it should use the Registry Browser to |
---|
| 230 | create the href attribute of Metadata nodes. So by adding the |
---|
| 231 | following line: |
---|
| 232 | |
---|
| 233 | .. code:: |
---|
| 234 | |
---|
| 235 | registryUrl = http://localhost/cgi-bin/zoo_loader.cgi?request=Execute&service=WPS&version=1.0.0&Identifier=GetFromRegistry&RawDataOutput=Result&DataInputs=id= |
---|
| 236 | |
---|
| 237 | The second option is to pre-generate each level of the hierarchy by |
---|
| 238 | running shell commands then set ``registryUrl`` to the URL to browse |
---|
| 239 | the generated files. In such a case, you will also have to define the |
---|
| 240 | ``registryExt`` and set it to the file extension you used to generate |
---|
| 241 | your registry cache. |
---|
| 242 | |
---|
| 243 | To generate the cache in ``/opt/zoo/registry/``, use the following command: |
---|
| 244 | |
---|
| 245 | .. code:: |
---|
| 246 | |
---|
| 247 | cd /usr/lib/cgi-bin |
---|
| 248 | mkdir /opt/zoo/regcache/{concept,generic,implementation} |
---|
| 249 | for i in $(find /opt/zoo/registry/ -name "*.*") ; |
---|
| 250 | do |
---|
| 251 | j=$(echo $i | sed "s:../registry//::g;s:.zcfg::g;s:.txt::g") ; |
---|
| 252 | if [ -z "$(echo $j | grep concept)" ]; |
---|
| 253 | then |
---|
| 254 | ext="xml" ; |
---|
| 255 | else |
---|
| 256 | ext="txt"; |
---|
| 257 | fi |
---|
| 258 | ./zoo_loader.cgi "request=Execute&service=wps&version=1.0.0&Identifier=GetFromRegistry&RawDataOutput=Result&DataInputs=id=$j" | grep "<" > /opt/zoo/regcache/$j.$ext; |
---|
| 259 | done |
---|
| 260 | |
---|