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: X3J JSON Schema draft


Following is a cut of the X3J JSON schema I've been working on. A newer cut is in the works, with better support for arrays of property values.  The PDX example Drummond posted is also translated to the newer version, but I want to work on the link contract bit a little before posting that.

{
	"version":"0.5.1",
	"id":"X3J",
     	"description":"XDI graph in JSON",
     	"type":"object",
     	"properties":{
		"id":{
			"optional":true,
         		"type":"string",
			"format":"XRI",
         		"description":"Identifier for graph, an XRI"
       			},
		"prefixes:{
			"optional":true,
       		  	"type":"array",
			"items":{
				"type":"string"
         			}
       			},
       		"tags":{
			 "optional":true,
        		  "type":"array",
        		  "items":{
				"type":"string"
         			}
       			},
       		"content":{
			"properties":{
				},
     			"additionalProperties":{
				"type":"object",
         			"description":"subject",
         			"optional":"true",
         			"properties":{
					},
         			"additionalProperties":{
					"type":"array",
					"description":"predicate",
             				"optional":"true",
					"items":{ 
    	      					  "description":"object",
						  "type":  [
						  	{
								"type":"object", 
								"description":"Object value that is an XRI",
								"properties":{
									"xri": {"type":"string", "format":"xri"}
								}
							},
							{
								"type":"object", 
								"description":"Object value that is a non-string literal",
								"properties":{
									"format": {"type":"string", "description":"MIME Media type for data value"},
									"value": {"type":"string"}
								}
							},
							{
								"type":"object", 
								"description":"Object value that is a xsd:string literal with an optional language specified",
								"properties":{
									"string": {"type":"string", "description":"The string value"},
									"lang": {
										"type":"string", 
										"format":"ftp://ftp.isi.edu/in-notes/bcp/bcp47.txt";, 
										"optional":true
									}
								}
							},
							{
								"type":"object", 
								"description":"Object value that is a xsd:duration",
								"properties":{
									"duration": {"type":"string", "description":"The value"}
								}
							},
							{
								"type":"object", 
								"description":"Object value that is a xsd:dateTime",
								"properties":{
									"dateTime": {"type":"string", "description":"The value"}
								}
							},
							{
								"type":"object", 
								"description":"Object value that is a xsd:time",
								"properties":{
									"time": {"type":"string", "description":"The value"}
								}
							},
							{
								"type":"object", 
								"description":"Object value that is a xsd:date",
								"properties":{
									"date": {"type":"string", "description":"The value"}
								}
							},
							{
								"type":"object", 
								"description":"Object value that is a xsd:gYearMonth",
								"properties":{
									"gYearMonth": {"type":"string", "description":"The value"}
								}
							},
							{
								"type":"object", 
								"description":"Object value that is a xsd:gYear",
								"properties":{
									"gYear": {"type":"string", "description":"The value"}
								}
							},
							{
								"type":"object", 
								"description":"Object value that is a xsd:gMonth",
								"properties":{
									"gMonth": {"type":"string", "description":"The value"}
								}
							},
							{
								"type":"object", 
								"description":"Object value that is a xsd:gMonthDay",
								"properties":{
									"gMonthDay": {"type":"string", "description":"The value"}
								}
							},
							{
								"type":"object", 
								"description":"Object value that is a xsd:gDay",
								"properties":{
									"gDay": {"type":"string", "description":"The value"}
								}
							},
							{
								"type":"object", 
								"description":"Object value that is a xsd:gMonth",
								"properties":{
									"gMonth": {"type":"string", "description":"The value"}
								}
							},
							{
								"type":"object", 
								"description":"Object value that is a xsd:boolean",
								"properties":{
									"boolean": {"type":"boolean", "description":"The value"}
								}
							},
							{
								"type":"object", 
								"description":"Object value that is a xsd:base64binary",
								"properties":{
									"base64binary": {"type":"string", "description":"The value"}
								}
							},
							{
								"type":"object", 
								"description":"Object value that is a xsd:hexBinary",
								"properties":{
									"hexBinary": {"type":"string", "description":"The value"}
								}
							},
							{
								"type":"object", 
								"description":"Object value that is a xsd:float",
								"properties":{
									"float": {"type":"number", "description":"The value"}
								}
							},
							{
								"type":"object", 
								"description":"Object value that is a xsd:double",
								"properties":{
									"double": {"type":"number", "description":"The value"}
								}
							},
							{
								"type":"object", 
								"description":"Object value that is a xsd:decimal",
								"properties":{
									"decimal": {"type":"number", "description":"The value"}
								}
							},
							{
								"type":"object", 
								"description":"Object value that is a xsd:integer",
								"properties":{
									"integer": {"type":"number", "description":"The value"}
								}
							},
							{
								"type":"object", 
								"description":"Object value that is a xsd:nonPositiveInteger",
								"properties":{
									"nonPositiveInteger": {"type":"number", "description":"The value"}
								}
							},
							{
								"type":"object", 
								"description":"Object value that is a xsd:negativeInteger",
								"properties":{
									"negativeInteger": {"type":"number", "description":"The value"}
								}
							},
							{
								"type":"object", 
								"description":"Object value that is a xsd:long",
								"properties":{
									"long": {"type":"number", "description":"The value"}
								}
							},
							{
								"type":"object", 
								"description":"Object value that is a xsd:int",
								"properties":{
									"int": {"type":"number", "description":"The value"}
								}
							},
							{
								"type":"object", 
								"description":"Object value that is a xsd:short",
								"properties":{
									"short": {"type":"number", "description":"The value"}
								}
							},
							{
								"type":"object", 
								"description":"Object value that is a xsd:byte",
								"properties":{
									"byte": {"type":"number", "description":"The value"}
								}
							},
							{
								"type":"object", 
								"description":"Object value that is a xsd:nonNegativeInteger",
								"properties":{
									"nonNegativeInteger": {"type":"number", "description":"The value"}
								}
							},
							{
								"type":"object", 
								"description":"Object value that is a xsd:unsignedLong",
								"properties":{
									"unsignedLong": {"type":"number", "description":"The value"}
								}
							},
							{
								"type":"object", 
								"description":"Object value that is a xsd:positiveInteger",
								"properties":{
									"positiveInteger": {"type":"number", "description":"The value"}
								}
							},
							{
								"type":"object", 
								"description":"Object value that is a xsd:unsignedInt",
								"properties":{
									"unsignedInt": {"type":"number", "description":"The value"}
								}
							},
							{
								"type":"object", 
								"description":"Object value that is a xsd:unsignedShort",
								"properties":{
									"unsignedShort": {"type":"number", "description":"The value"}
								}
							},
							{
								"type":"object", 
								"description":"Object value that is a xsd:unsignedByte",
								"properties":{
									"unsignedByte": {"type":"number", "description":"The value"}
								}
							},
							{
								"type":"object", 
								"description":"Object value that is a context",
								"properties":{
									"/": {
		     			     				     "type":"object", 
		     			     				     "description":"The XDI-JSON for the context content"
		     			     				     "schema": {
		     	       		     	       			     	       "version":"0.5.1",
			       			       				       "id":"X3J"
		     	       		      				      }
		    			 		         	 }
								}
							}
						]
					}
        			}
			}
		}
	}

Two caveats:
------------
- XDI prefixes working model : take form of {nsprefix}..{name}, ex pdx..$address
- Referencing a schema that's recursive..., not in JSON Schema spec AFAIK , went with form of:
									{
		     			     				     "type":"object", 
		     			     				     "schema": {
		     	       		     	       			     	       "version":"0.5.1",
			       			       				       "id":"XDI-JSON"
		     	       		      				      }
		    			 		         	 }
Next step is to take an example XDI document, maybe PDX example is a a good one that's publicly releasable, convert it to X3J, and validate against the above schema using http://james.newtonking.com/projects/json/schema.aspx. I've already started on that and expect to have it finished by the end of the weekend. 


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