incf-nidash / nidm-specs

Neuroimaging Data Model (NIDM): describing neuroimaging data and provenance
nidm.nidash.org
Other
33 stars 30 forks source link

Specific type for json arrays (rather than xsd:string)? #297

Open cmaumet opened 9 years ago

cmaumet commented 9 years ago

This issue is open to keep track of a discussion point raised during NIDASH call on March 23rd (Minutes, also cf. #270):

In the following example "xsd:string" would thus be replaced by a more specific type outlining that prov:value is a json-array:

niiri:contrast_id a prov:Entity , nidm:ContrastWeights ;
    ... other attributes ...
    prov:value "[1, 0, 0]"^^xsd:string ;
satra commented 9 years ago

still looking for this.

dbkeator commented 9 years ago

Could we do something like this?

@prefix jsd http://json-schema.org/draft-04/schema# ... niiri:contrast_id a prov:Entity , nidm:ContrastWeights ; ... other attributes ... prov:value "[1, 0, 0]"^^jsd:array ;

nicholsn commented 9 years ago

I don't think standard rdf parsers will know how to handle this, will they?

On Fri, Apr 10, 2015 at 3:21 PM, David Keator notifications@github.com wrote:

Could we do something like this?

@prefix https://github.com/prefix jsd http://json-schema.org/draft-04/schema# ... niiri:contrast_id a prov:Entity , nidm:ContrastWeights ; ... other attributes ... prov:value "[1, 0, 0]"^^jsd:array ;

— Reply to this email directly or view it on GitHub https://github.com/incf-nidash/nidm/issues/297#issuecomment-91707503.

dbkeator commented 9 years ago

I'm not sure about the syntax. Essentially I'm thinking we could reference an array type from the json schema http://json-schema.org/draft-04/schema# (for example) similar to what we did with xsd:string. In the json schema linked above they have:

"stringArray": { "type": "array", "items": { "type": "string" }, "minItems": 1, "uniqueItems": true }

I don't have a firm grasp of validating json documents but if I use the same principles as XML schema then essentially we'd build a json schema document that defines integerArray or numberArray as below and use that as the schema then if we were using integerArray (or numberArray) in a json document it would validate against the schema. If our NIDM documents were serialized in json then the document should validate and a parser shouldn't have problems with it because it would be a well formed json document. In our case we're using TURTLE (or PROVN) and then adding in an xml schema type so it's a bit confusing to me:

"integerArray": { "type": "array", "items": { "type": "integer" }, "minItems": 1, "uniqueItems": true }