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: Mapping arbitrary JSON to XDI


Michael, no need to apologize, you are absolutely right to ask, "Who else can answer them?"

You have come to the right place. We know we need another entire round of documentation and tutorials, and we are starting to work on that.

See inline.


On Fri, Dec 14, 2012 at 1:43 PM, Michael Andronov <info@sd-kyber.com> wrote:
Markus - 

Thank a lot for the tool!

A few weeks ago, I mentioned that I have a hard time to get used to XDI syntax, while it seems  you, guys are fluent. Let me use the tool  to illustrate what I mean:

So, I took example 5,  RAWJSON -> XDI/JSON conversion. 
The tool converts 
 "age": 25    -->   "$!(+(age))/!": ["25"]

I took pg. 2 of 'XDI Graph Patterns', 2012-05[31 - the page, where each $, !, +, () is given some explanation - and managed to make some sense of XDI/JSON part…

Then, I looked into another line:
"….
"address":
     { ...
       "city": "New York",
...
converted as
"+(address)$!(+(city))/!": ["New York"]
"
And I get lost. I can not understand why the syntax is like that. Following the previous line - "age": 25 - why the address line is not converted as:
a. "$!(+(address))$!(+(city))/!": ["New York"]
b. "$!(+(address))$(+(city))/!": ["New York"]
c. "$!(+(address)+(city))/!": ["New York"]

?

The answer to this lies entirely in the rules for XDI multiplicity, which are specified in this approved proposal on the XDI TC wiki:

    https://wiki.oasis-open.org/xdi/XdiMultiplicity

If you read through that, and in particular the five syntax rules, all the mystery around multiplicity syntax should go away (it is without a doubt the most confusing part of XDI syntax until you know the rules. Once you know the rules, it's pretty easy.

Also, Markus's code also involves rules for XDI dictionaries, namely that all dictionary definitions (read, "type definitions") begin with either +(+ (for generic global definitions) or +($  (for specific global definitions defined by the XDI TC). The basic patterns are documented here (and a full XDI dictionary process proposal is in progress now):

  https://wiki.oasis-open.org/xdi/XdiDictionaryPatterns

So, to be specific in answering your question with regard to 

    +(address)$!(+(city))/!": ["New York"]

The first subsegment, +(address), simply establishes that the second subsegment, $!(+(city)), is in the context of a datatype know by the local name of "address". It is local because the string "address" sits by itself without any global context symbol inside the paratheses. (That means that if any XDI definition of +(address) is available, it will only be available in the local graph, under the address +(+(address)). See https://wiki.oasis-open.org/xdi/XdiDictionaryPatterns)

The second subsegment, $!(+(city)), is an attribute singleton since it begins with $!(  -- that means it has a literal value. In this case that literal value is an instance of the local definition +(city), which again, does not have a global address (this makes sense because when converting raw JSON, each name/value pair or object key is local to that JSON instance).
 

And what would be the difference between a,b, or c in above from the converter output?

All of them are legal XDI syntax, so it just comes down to the multiplicity and dictionary rules in terms of what their semantics are. I could go into details, but why don't you read the two wiki pages linked above and then post back with and questions -- which will be very helpful, as one of my tasks over the holiday break is to write a tutorial on XDI syntax, including multiplicity and dictionary syntax.
 

I'm pretty sure that there is a good reason why it is so. ( And I'm apologizing if I missed something obvious… ).
But I would really like to get to the bottom of it. ;)
Is there any document, known practice exercise(s), etc  for self-education? Suggestions?  

Again, we know that the current documentation is inadequate, so we will be working to add more. In the meantime, Markus's tools are the best way to learn.
 

My next question is - !39e9b4db-dd0f-4de9-b344-7978f718d1e5. Is it some kind of a new identifier? Is it some kind of a new format for XDI number?

That one is easy. Since it starts with a !, it is a local i-number. There's nothing else special about it -- XRI syntax does not limit the length of an i-number, although from the format it's clear that this i-number was generated as a UUID. So it has the property of being globally unique (although you don't know that just by looking at it).
 

Sorry for those newbie questions, but who else can answer them ?  ;)

Again, exactly right. Just keep posting your questions here.

Best,

=Drummond   



On 2012-12-14, at 11:20 AM, Markus Sabadello <markus.sabadello@xdi.org> wrote:

In order to be able to map non-XDI data sources such as Facebook, Google Calendar, etc. to XDI, I am thinking it would be useful to have a generic JSON->XDI mapping ability, because that's the format that most of these APIs are based on.

So I played with this a bit, you can go to

Select "RAW JSON" as the input format, and try sample 5 or sample 6 or any other JSON format.

Markus


--
You received this message because you are subscribed to the Google Groups "XDI2" group.
To post to this group, send email to xdi2@googlegroups.com.
To unsubscribe from this group, send email to xdi2+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

--
You received this message because you are subscribed to the Google Groups "XDI2" group.
To post to this group, send email to xdi2@googlegroups.com.
To unsubscribe from this group, send email to xdi2+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
 
 



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