Ticket #72 (closed enhancement: fixed)

Opened 7 years ago

Last modified 6 years ago

Handling cardinality upper than 1

Reported by: djay Owned by:
Priority: major Milestone:
Component: zoo-kernel Version:
Keywords: Cc: matthias.lendholt@…, djay

Description

Consider an input named A, if the cardinality of A was set (through the maxOccurs value in the zcfg) to a value > 1 then the ZOO-Kernel should provide a specific array structure.

The idea is to provide the inputs as presente in the following:

{
 "A": {
   "name": "A",
   "value": ["<val1>","<val2>",...,"<valN>"],
   "mimeType": ["<mimeType1>","<mimeType2>",...,"<mimeTypeN>"],
   "isArray": "true"
 }
}

The specific "isArray" map will be automatically added by the ZOO-Kernel for inputs provided more than once in the request and getting a maxOccurs value set to a value upper than 1 in the ZCFG file.

For Python, Java and Javascript language wethe ZOO-Kernel shall be directly provide the data as an Array in the dictionnary, HasMap or Javascript Object representing the inputs.

For C language we may think of using json-c library to handle storage and access to the the inputs value.

Change History

Changed 7 years ago by djay

  • cc matthias.lendholt@… gerald.fenoy@… added
  • type changed from defect to enhancement
  • component changed from Development platform to zoo-kernel
  • milestone set to 1.3dev

Changed 7 years ago by djay

  • cc djay added; gerald.fenoy@… removed

Changed 7 years ago by djay

  • status changed from new to closed
  • resolution set to fixed

Now when you set maxOccurs value upper or equal to 2 in the ZCFG file then the corresponding service will receive an array for both mimeType/dataType/CRS depending on the inputs type and value as arrays. Note that other map which may be available (such as xlink:href, Reference, schema and uom are also available as for instance xlink:href_N where N is an integer in [minOccurs,maxOccurs]).

You can set maxOccurs=unbounded if the inputs identifier can occur without any limit.

Example: In the HelloPy.zcfg file set maxOccurs value to 2, then modify the test_service.py to get the following definition for HelloPy:

def HelloPy(conf,inputs,outputs):
        import sys
        print >> sys.stderr,str(inputs)
        outputs["Result"]["value"]="Hello "
        if isinstance(inputs["name"]["value"], (list, tuple)):
                for i in range(0,len(inputs["name"]["value"])):
                        if i+2<len(inputs["name"]["value"]):
                                outputs["Result"]["value"]+=str(inputs["name"]["value"][i])+", "
                        else:
                                if i+1<len(inputs["name"]["value"]):
                                        outputs["Result"]["value"]+=str(inputs["name"]["value"][i])+" and "
                                else:
                                        outputs["Result"]["value"]+=str(inputs["name"]["value"][i])
        else:
                outputs["Result"]["value"]+=inputs["name"]["value"]
        outputs["Result"]["value"]+=" from the ZOO-Project Python world !"
        return 3

When you set maxOccurs value to value upper or equal to 2 but the client provide only one value for this identifier then a simple string will be used rather than the array or string.

Changed 6 years ago by djay

  • milestone 1.3dev deleted

Milestone 1.3dev deleted

Note: See TracTickets for help on using tickets.

Search

Context Navigation

ZOO Sponsors

http://www.zoo-project.org/trac/chrome/site/img/geolabs-logo.pnghttp://www.zoo-project.org/trac/chrome/site/img/neogeo-logo.png http://www.zoo-project.org/trac/chrome/site/img/apptech-logo.png http://www.zoo-project.org/trac/chrome/site/img/3liz-logo.png http://www.zoo-project.org/trac/chrome/site/img/gateway-logo.png

Become a sponsor !

Knowledge partners

http://www.zoo-project.org/trac/chrome/site/img/ocu-logo.png http://www.zoo-project.org/trac/chrome/site/img/gucas-logo.png http://www.zoo-project.org/trac/chrome/site/img/polimi-logo.png http://www.zoo-project.org/trac/chrome/site/img/fem-logo.png http://www.zoo-project.org/trac/chrome/site/img/supsi-logo.png http://www.zoo-project.org/trac/chrome/site/img/cumtb-logo.png

Become a knowledge partner

Related links

http://zoo-project.org/img/ogclogo.png http://zoo-project.org/img/osgeologo.png