RE: JSON Schema (json-schema.org) support?

On Wednesday, August 21, 2013 12:00 AM, Robert Sanderson wrote:
> * {"@id": "uri"}  -- hopefully with additional keys
> * "uri" or "compactIRI"

Framing just turn @id-objects to strings if there's a @type: @id coercion in
the (frame) context. Otherwise they remain @id objects.

> * List of the above when the predicate is repeated in the RDF

Set the property's @container to @set and it will remain an array. There's
also an API flag compactArrays which allows you to turn this behavior off
globally.


> One issue that came up with validation was determining if a string was
> a URI or not given the context rules.  The "format": "uri" rule isn't
> correct, as it could be a compact IRI.

Just don't compact URIs to strings and differentiante by @id vs. @value.


> There also should be different
> rules for "@type" URIs than regular resources as they should be just a
> string rather than ever a resource conveyed as an object (right?)

Right. You don't have to worry about that though because the JSON-LD API
verifies that internally already.


> And for values:
> 
> * "value" (or value for integers)
> * {"@value": "value"} hopefully with additional keys such as language
> and type

That can be prevented by not compacting at all, i.e., framing without a
context. It's admittedly not very elegant though.


> * List of the above when the predicate is repeated in the RDF

See above


> So even with framing there's still quite a lot of variability,
> depending on the use case and context of course.

It's sometimes tricky to work around that variability but tried hard to give
developers a lot of control in that regard.


> And this isn't a criticism of JSON-LD at all, just an observation of
> the challenges with JSON-Schema :)

:-)


--
Markus Lanthaler
@markuslanthaler

Received on Tuesday, 20 August 2013 22:26:41 UTC