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: New XDI JSON serialization format that *does not require a separate display format*


While working on the "How XDI Builds on RDF" paper, I have been thinking about conventional RDF triples so much that a simple thought occurred to me: "Why does XDI flat serialization format need to repeat the XDI subject for every subject/predicate key?"

The answer, of course, is that in the flat serialization format, the subject/predicate combo provides the unique key for every XDI object. So for key/value stores, it makes sense to serialize it that way.

But I wondered what it would look like if we broke apart the XDI subject and XDI predicate so that each unique XDI subject appeared exactly once under any XDI root node—just like each predicate appears once under a subject and each object appears once under a predicate in the flat serialization format.

A hour of playing this weekend and voila, JSON triples format was born. What I didn't expect was that the result would make the triples so readable in the native JSON that IMHO we would no longer need a separate display format—except for special cases where you want to drop all the JSON delimiters and extra lines.

To be specific, if we adopt this as our default serialization format, then I would propose that all of the examples in the XDI 1.0 specs just use JSON triples format. No need to repeat them in a separate display format—it would just confuse readers.

Take a look yourself at these examples below. To make it easy, I've highlighted a first-level inner graph (a simple link contract) in blue and a second-level inner graph (a policy _expression_) in red.

See additional details and benefits in the writeup on this wiki page.

=Drummond 


JSON TRIPLES FORMAT EXAMPLE

{
    "=drummond[<#email>]!0": {
        "&": "drummond@example.com"
    },
    "=drummond[<#email>]!1": {
        "&": "dsr@example.net"
    },
    "=drummond<#email>": {
        "$ref": [
            "=drummond{<#email>]!0"
        ]
    },
    "=drummond<#home><#email>": {
        "$ref": [
            "=drummond{<#email>]!1"
        ]
    },
    "=drummond<#work><#email>": {
        "$ref": [
            "=drummond{<#email>]!1"
        ]
    },
    "=drummond": {
        "#spouse": [
            "=monique.reed"
        ],
        "#friend": [
            "=markus",
            "=joseph.boyle",
            {
                "+respect#card$do": {
                    "$get": [
                        "=drummond<#home><#email>"
                    ]
                },
                "+respect#card$do$if": {
                    "$true": [
                        {
                            "{from}": {
                                "$is#friend": [
                                    "=drummond"
                                ]
                            }
                        }
                    ]
                }
            }
        ]
    }
}


TRIPLES DISPLAY FORMAT EXAMPLE (same graph as above)

=drummond[<#email>]!0
&
=drummond[<#email>]!1
&
=drummond<#email>
$ref
           =drummond{<#email>]!0
=drummond<#home><#email>
$ref
=drummond{<#email>]!1
=drummond<#work><#email>
$ref
=drummond{<#email>]!1
=drummond
#spouse
=monique.reed
 #friend
=markus
=joseph.boyle
{
+respect#card$do
$get
=drummond<#home><#email>
+respect#card$do$if
$true
{
{from}
$is#friend
=drummond





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