[Application-profiles-ig] ShEx JSON proposal for DSP

Karen Coyle kcoyle at kcoyle.net
Mon Sep 2 00:28:02 BST 2019


Forgot: [1]https://github.com/dcmi/dcap/blob/master/patterns.mdkc On 9/1/19 4:12 PM, Karen Coyle wrote: >Thanks, Eric & Tom, for this example.>>I think we can be confident that simple profiles will be also>expressible in a variety of formats and validation languages. To confirm>this, we need to see transformations from a simple documentation>language (csv? other?) to those schemas. We could set up a table with>the current thinking on data structures and elements where we could put,>side-by-side, statements in validating schemas. OR we could treat this>less like a one-to-one and more like an overall algorithm, writing the>algorithm that could transform the simple documents.>>Where I feel less confident is in how we could express more complex>rules in a simple profile, and by "more complex" I am referring to those>that employ "and, or, not" logic. These are noted in the patterns>document [1] on the dcap github. All of these are well-handled by most>if not all programming languages and by the various schema languages.>The question for us is how many of these we can find a way to express in>a very simple vocabulary.>>Meanwhile, let's continue with the easier matter of the simple>expression of profiles as essentially key/value pairs, and see how far>we can get with that.>>May I say that the examples below would be most helpful if they could>include the simple profile view as the starting point, not the ShExC or>J view, which would be transformations of the profile, likely output>from some code that goes against the profile. That would help illustrate>where this fits in to the work that we are doing.>>Thanks,>kc>>On 8/30/19 3:17 AM, Eric Prud'hommeaux wrote:>>Tom and I worked out a quick subset of ShExJ to meet apparent (simple)>>DSP requirements. Let's call it ShExJ-Lite. It is valid JSON-LD:>>"@context": "http://www.w3.org/ns/shex.jsonld">>>>This subset captures, for example, this ShExC:>>[[>>前缀dc: <http://purl.org/dc/terms/>>>PREFIX foaf: <http://xmlns.com/foaf/0.1/>>>PREFIX xsd: <http://www.w3.org/2001/XMLSchema#>>>BASE <http://a.example/schema>>>>><#book> {>>dc:title xsd:string ;>>dc:creator @<#person>+ ;>>}>>>><#person> {>>foaf:name xsd:string+ ;>>foaf:homepage IRI?>>}>>]]>>>>(See below for the proposed ShExJ-Lite equivalent.)>>>>Here's the ShExJ-Lite grammar:>>>>模式{ start:shapeExpr? shapes:[shapeExpr+]? }>>shapeExpr = NodeConstraint | Shape ;>>shapeExprLabel = IRIREF | BNODE ;>>NodeConstraint { id:shapeExprLabel nodeKind:("iri" | "bnode" | "nonliteral" |>>"literal")? datatype:IRIREF? numericFacet* values:[valueSetValue]? }>>numericFacet = (mininclusive|minexclusive|maxinclusive|maxexclusive):numericLiteral>>numericLiteral = INTEGER | DECIMAL | DOUBLE ;>>valueSetValue = objectValue | IriStem ;>>objectValue = IRIREF | ObjectLiteral ;>>ObjectLiteral { value:STRING language:STRING? type:STRING? }>>IriStem { stem:IRIREF }>>Shape { id:shapeExprLabel expression:tripleExpr}>>tripleExpr = EachOf | TripleConstraint ;>>EachOf { expressions:[tripleExpr}>>TripleConstraint { predicate:IRIREF valueExpr:shapeExpr? min:INTEGER? max:>>INTEGER}>>>>and here's the ShExJ representation of the simple book schema above:>>>>{>>"type": "Schema",>>"@context": "http://www.w3.org/ns/shex.jsonld",>>"shapes": [>>{>>"type": "Shape",>>"id": "http://a.example/schema#book",>>"expression": {>>"type": "EachOf",>>"expressions": [>>{>>"type": "TripleConstraint",>>"predicate": "http://purl.org/dc/terms/title",>>"valueExpr": {>>"type": "NodeConstraint",>>"datatype": "http://www.w3.org/2001/XMLSchema#string">>}>>},>>{>>"type": "TripleConstraint",>>"predicate": "http://purl.org/dc/terms/creator",>>"valueExpr": "http://a.example/schema#person",>>"min": 1,>>"max": -1>>}>>]>>}>>},>>{>>"type": "Shape",>>"id": "http://a.example/schema#person",>>"expression": {>>"type": "EachOf",>>"expressions": [>>{>>"type": "TripleConstraint",>>"predicate": "http://xmlns.com/foaf/0.1/name",>>"valueExpr": {>>"type": "NodeConstraint",>>"datatype": "http://www.w3.org/2001/XMLSchema#string">>},>>"min": 1,>>"max": -1>>},>>{>>"type": "TripleConstraint",>>"predicate": "http://xmlns.com/foaf/0.1/homepage",>>"valueExpr": {>>"type": "NodeConstraint",>>"nodeKind": "iri">>},>>"min": 0,>>"max": 1>>}>>]>>}>>}>>]>>}>>>>-->>-ericP>>>-- Karen Coylekcoyle at kcoyle.nethttp://kcoyle.netskype: kcoylenet


More information about the Application-profiles-ig mailing list