1237Re: [json] Need for "abstract data model" to support JSON, web services ("useful parts of w3c schema", not validation)
- Apr 27, 2009Tatu Saloranta scripsit:
> > isNull(keyName)All these predicates are on the JSON object itself, because they are used
> Would this mean it has to be null, or that it is nullable (allowsNull)?
before the object's type is known. So isNull("foo") means that there
is a key "foo" in the JSON object value is null, and likewise with all
the other primitives.
> > isUndefined(keyName)No, it means that the specified key does not exist. I use the name
> does this mean "any type"? Sort of fallback, xml "any" type.
little point in an isAnyType predicate, because it would match anything
*except* a missing key.
> > isNumeric(keyName)That's reasonable. In that case it would be useful to be able to map
> perhaps also isInteger/integral?
keys to integer as well, and perhaps standardized subtypes of integer too.
> - [U]nion types that are not mappable to OO ("value can beMultiple inheritance is a subset of this (doesn't handle primitives).
> either an array or boolean"): this just means there are legal JSON
> constructs for which no strict can be defined.
If type foobar is a subtype of types foo and bar, then effectively it
is a union of them.
One question: should the predicates and the maps do on-the-fly conversion?
For example, if we specify a predicate of hasNumericValue("foo", 0),
does "foo": "0" match, or do we require "foo": 0? Likewise, when
mapping, if the map specifies bar->String and the object contains
"bar": 123, does the bar field get "123", or is that an error?
These questions are independent. I'd favor doing the conversions.
You let them out again, Old Man Willow! John Cowan
What you be a-thinking of? You should not be waking! cowan@...
Eat earth! Dig deep! Drink water! Go to sleep!
Bombadil is talking. http://ccil.org/~cowan
- << Previous post in topic Next post in topic >>