OASIS Mailing List ArchivesView the OASIS mailing list archive below
or browse/search using MarkMail.

 


Help: OASIS Mailing Lists Help | MarkMail Help

xdi message

[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index] | [List Home]


Subject: one advantage of "collection not typed, members typed"


In open issue #5, we're leaning toward option 2.

However I found one use case where option 1 works better.
That use case is mapping any arbitrary JSON structure to XDI.
This could be useful when implementing XDI connectors for external APIs that are based on JSON.

Example:

Currently, the following example JSON structure:

{
    "firstName": "John",
    "lastName": "Smith",
    "age": 25,
    "address": [
        "91 Western Road, Brighton, East Sussex, England, BN1 2NW",
        {
            "streetAddress": "21 2nd Street",
            "city": "New York",
            "state": "NY",
            "postalCode": "10021"
        }
    ]
}

Could be mapped to XDI as follows:

$!(+(age))/$is+/+$json$number
$!(+(age))/!/(data:,25)
$!(+(firstName))/!/(data:,John)
$!(+(lastName))/!/(data:,Smith)
$(+(address))$!(!cQlI_cKyMIfD3rCbHkWFRQUJtVLyfV1zJ3vKUPSSWvA)/!/(data:,91%20Western%20Road,%20Brighton,%20East%20Sussex,%20England,%20BN1%202NW)
$(+(address))$(!kClyz4ARycEJmZX5A7NIoVjStRf-jSGejXPtiRPv_Q4)$!(+(city))/!/(data:,New%20York)
$(+(address))$(!kClyz4ARycEJmZX5A7NIoVjStRf-jSGejXPtiRPv_Q4)$!(+(postalCode))/!/(data:,10021)
$(+(address))$(!kClyz4ARycEJmZX5A7NIoVjStRf-jSGejXPtiRPv_Q4)$!(+(state))/!/(data:,NY)
$(+(address))$(!kClyz4ARycEJmZX5A7NIoVjStRf-jSGejXPtiRPv_Q4)$!(+(streetAddress))/!/(data:,21%202nd%20Street)

This is possible, because the $(+(address)) collection can have one attribute member and one entity member at the same time.

With the proposed change to option 2, this would no longer be possible (or be more difficult).
I think then the way to do it would be to have TWO collections, i.e. one attribute collection and one entity collection, but I am not sure if that is very clean.

Therefore, although initially I also preferred option 2, I think for me this is reason enough to now switch to option 1.

Markus



[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index] | [List Home]