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: Re: [xdi] Replacing X3 with Semantic JSON


Hi there,

I think both examples have good ideas, and I'm looking forward to coming up with the best ultimate format, but my request to this thread would be to first figure out what's going to be in the graph model, and then based on that figure out the JSON (and other) serialization formats..

For example, looking at this part of Bill's example:
               "+role": [
                    {"string": "editor", "lang":"en"},
                    {"string": "éditeur", "lang":"fr"}
               ],

Does that mean in an XDI literal we can have different values based on language?
Or does it mean we can have arbitrary metadata on literal values?
etc.

And like Bill says, Drummond's and Joseph's example isn't valid JSON, so it would be good to post a fixed version..

Markus

On Thu, Aug 12, 2010 at 7:45 AM, Barnhill, William [USA] <barnhill_william@bah.com> wrote:

I'm planning to dial into telecon tomorrow, as long as the non-skype number is working (no skype where I work).

 

Below is the same example in the most recent version of X3J I created,
which merged some concepts from Markus"s version with my enhancements to
the JSON schema I had posted to the list.
 
Four predicates have been added for =drummond: +flagged, +empnum,
+role, and +ticketnums, a boolean, int, string, and an int array
respectively. I added these to show how literals other than strings
are handled, and how string language is represented.

 

A thing to highlight is the base attribute, which serves basically the
same function as xml:base in that if it is anything other than "$" then
the subject XRI segments are interpreted as relative, delegated to from
the base (e.g +work in a graph with base of =drummond becomes
=drummond+work).
 
Another to highlight are that string, XML, and base64 literals
can be either a single long string, or an array of shorter strings. In
the case of XML or a regular string the elements in the array are
joined together during processing using the system line delimiter. In
the case of base64 the elements are joined together with no delimiter.

 

I also added a +home+address to show contexts, and a comment about
+drummond using the "$ann" predicate. This predicate and its
values are treated as not included in the graph when reasoning occurs,
similar to RDF annotations such as rdfs:comment.

 

I believe what I have as {"boolean", true} would be
{"$":{"$a$boolean": "true"}} in the Semantic JSON format proposed?

 

Btw the example for Semantic JSON won"t parse as is unless you apply
some minor fixes, as JSON won"t except multiline string literals (like
XML literal) and the email sig predicate is missing a " and :.

 

You can validate JSON at http://www.jsonlint.com/.

 

Also, in the example below if typeof an item of the predicate value array
is "string" then that is processed equivalent to {"xri", string here}.

 

{ "id" : "=drummond",
  "base": "$",
  "content":


     {
          "=drummond": {
               "$is": [
                    "=drummond.reed",
                    "=!F83.62B1.44F.2813"
               ],
               "$is$a": [
                    "+person",
                    "@oasis+chair"
               ],
               "$has": [
                     "+home",
                     "+work",
                     "+role",
                     "+friend",
                     "@cordance",
                     "@parity",
                     "+flagged",
                     "+ticketnums",
                     "+empnum"
               ],
               "$ann": [{"content":
                                {"$": {
                                     "+comment$1": {"string": "Will be at XDI retreat"}
                                }}
                        }
               ],
               "+flagged": [
                    {"boolean": true}
               ],
               "+role": [
                    {"string": "editor", "lang":"en"},
                    {"string": "ꥩteur", "lang":"fr"}
               ],
               "+empnum": [
                    {"int": 12345}
               ],
               "+ticketnums": [
                    {"ints": [1234, 343, 232]}
               ],
               "+email": [
                     "=drummond+home+email",
                     "=drummond+work+email"
               ],
               "+email+signature": [{"xml":[
                        "<?xml version=\"1.0\" encoding=\"ISO-8859-1\"?>",
                        "<signature xmlns=\"
http://example.com/ns\">",
                        " <name>Drummond Reed</name>",
                        " <affiliation>Cordance</affiliation>",
                        " <affiliation>Parity</affiliation>",
                        " <affiliation>OASIS</affiliation>",
                        "</signature>"  
                    ]}
               ],
               "+picture": [{"json":

                    {"Image": {
                         "Width": 800,
                         "Height": 600,
                         "Title": "Drummond at Graduation",
                         "Thumbnail": {
                              "Url": "
http://www.example.com/image/481989943",

                              "Height": 125,
                              "Width": 100
                         },
                         "IDs": [116,943, 234, 38793]
                    }}
               }],
               "=web*markus": ["=drummond+friend"]
          },
          "=drummond+home": {
               "+email": [{"string": "
drummond@example.com"}],
               "+address": [{"content":
                                {"$": {
                                     "+street": {"string": "main st"},
                                     "+region": "+region+us+wa+seattle",
                                     "+postalcode": {"string": "12345"}
                                }}
                           }]
          },
          "=drummond+work": {
               "+email": [
                     "
=drummond@cordance+email",
                     "
=drummond@parity+email"
               ]
          },
          "
=drummond@cordance": {
               "+email": [{"string": "
drummond.reed@cordance.example.com"}]
          },
          "
=drummond@parity": {
               "+email": [{"string": "
drummond.reed@parity.example.com"}]

          },
          "=drummond+friend": {
               "$is$a": [
                    "$contract",
                    "@identity.commons$contract",
                    "@identity.commons+personal$contract"
               ],
               "$get": [
                    "=drummond+home",
                    "=drummond+work"
               ]
          }
     }
}


From: drummond.reed@gmail.com [mailto:drummond.reed@gmail.com] On Behalf Of Drummond Reed
Sent: Thursday, August 12, 2010 5:22 AM
To: OASIS - XDI TC
Subject: [xdi] Replacing X3 with Semantic JSON

First, a reminder to everyone that we are not holding the regular XDI TC telecon tomorrow due to many of us travelling to the XDI Retreat in Whistler. Instead we will be holding a telecon on Friday, tentatively starting at 11AM Pacific Time, on our normal bridge number. We'll send out more details about that tomorrow night.

Second, to start off the retreat with a bang, after several long Skype sessions with Joseph in the last two days, he and I have a fascinating proposal to make: replacing X3 with Semantic JSON (Joseph's proposed name for the hybrid of Markus' and Bill's suggestions for the XDI JSON serialization format).

First let me explain the proposed format for Semantic JSON:

a) The X3J serialization format currently produced by Markus' XDI Converter utility at http://higgins.eclipse.org/xdi-converter/XDIConverter (see examples below) PLUS

b) A new escaping mechanism (see second example below) PLUS

c) The addition of support for all native JSON data types, with the requirement that native JSON objects and native JSON arrays must use the escaping mechanism (because otherwise they conflict with how the Semantic JSON serialization format uses JSON objects and JSON arrays to encode the XDI graph).

Second, the reason we think it can replace X3 is:

1) Semantic JSON is so close to X3 that we don't really gain much benefit from having two formats so similar.

2) Semantic JSON will now support all the native JSON datatypes (with the escaping rules above), so it is even more JSON friendly (which is what Bill has been arguing for).

3) If Semantic JSON is the default XDI format, it will make XDI more friendly and approachable to many developers.

4) We no longer have to worry about the three formats of X3 (Standard, Whitespace, Simple) -- JSON already has its own formatting conventions.

The only downside is not having support for comments. However I have an idea for a workaround that I'll float at the retreat.

Thoughts?

=Drummond


EXAMPLE OF CURRENT X3J FORMAT

{
"=drummond": {
"$is":
[
"=drummond.reed",
"=!F83.62B1.44F.2813"
],
"$is$a":
[
"+person",
"@oasis+chair"
],
"$has":
[
"+home",
"+work",
"+friend",
"@cordance",
"@parity"
],
"+email":
{
"=drummond+home": {
"+email": null
},
"=drummond+work": {
"+email": null
}
},
"+email+signature$a$xml": "
\n <?xml version=\"1.0\" encoding=\"ISO-8859-1\"?>
\n <signature xmlns=\"http://example.com/ns\">
\n <name>Drummond Reed</name>
\n <affiliation>Cordance</affiliation>
\n <affiliation>Parity</affiliation>
\n <affiliation>OASIS</affiliation>
\n </signature>
\n ",
"+picture$a$json":
{
"Image": {
"Width": 800,
"Height": 600,
"Title": "Drummond at Graduation",
"Thumbnail": {
"Url": "http://www.example.com/image/481989943",
"Height": 125,
"Width": "100"
},
"IDs":[116, 943, 234, 38793]
}
}
,
"=web*markus":
[
"=drummond+friend"
]
},
"=drummond+home": {
"+email": "drummond@example.com"
},
"=drummond+work": {
"+email":
{
"=drummond@cordance": {
"+email": null
},
"=drummond@parity": {
"+email": null
}
}
},
"=drummond@cordance": {
"+email": "drummond.reed@cordance.example.com"
},
"=drummond@parity": {
"+email": "drummond.reed@parity.example.com"
},
"=drummond+friend": {
"$is$a":
[
"$contract",
"@identity.commons$contract",
"@identity.commons+personal$contract"
],
"$get":
{
"=drummond+home": null,
"=drummond+work": null
}
}
}

EXAMPLE OF NEW PROPOSAL

Note that this is identical to the above except it shows the new proposed escaping mechanism (see text in red). This escaping would apply to both non-XDI JSON objects and non-XDI JSON arrays, as well as to XML or other text-based data formats. This example this does not yet show examples of a native JSON number or boolean.

{
"=drummond": {
"$is":
[
"=drummond.reed",
"=!F83.62B1.44F.2813"
],
"$is$a":
[
"+person",
"@oasis+chair"
],
"$has":
[
"+home",
"+work",
"+friend",
"@cordance",
"@parity"
],
"+email":
{
"=drummond+home": {
"+email": null
},
"=drummond+work": {
"+email": null
}
},
"+email+signature
{
"$": {

$a$xml": "
\n <?xml version=\"1.0\" encoding=\"ISO-8859-1\"?>
\n <signature xmlns=\"http://example.com/ns\">

\n <name>Drummond Reed</name>
\n <affiliation>Cordance</affiliation>
\n <affiliation>Parity</affiliation>
\n <affiliation>OASIS</affiliation>
\n </signature>

\n ",
}
}
"+picture
{

"$": {
$a$json": "
{

"Image": {
"Width": 800,
"Height": 600,
"Title": "Drummond at Graduation",

"Thumbnail": {
"Url": "http://www.example.com/image/481989943",
"Height": 125,

"Width": "100"
},
"IDs":[116, 943, 234, 38793]
}

}

}
,
"=web*markus":
[
"=drummond+friend"
]
},
"=drummond+home": {

"+email": "drummond@example.com"
},
"=drummond+work": {
"+email":
{
"=drummond@cordance": {
"+email": null

},
"=drummond@parity": {
"+email": null
}
}
},
"=drummond@cordance": {
"+email": "drummond.reed@cordance.example.com"

},
"=drummond@parity": {
"+email": "drummond.reed@parity.example.com"
},
"=drummond+friend": {
"$is$a":

[
"$contract",
"@identity.commons$contract",
"@identity.commons+personal$contract"
],
"$get":
{
"=drummond+home": null,
"=drummond+work": null

}
}
}







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