Re: GraphQL and SHACL

I would say that the main feature of a compact syntax is that it is compact.  
If the desire is for a syntax with maximum user friendliness then call it a
"user friendly syntax" and don't worry whether it is compact or not.


If compactness is not the ultimate goal then the ShExC syntax is a worthy
candidate.  It would have to be slightly modified but it does have most of the
required constructs.


The syntax I was referring to is the syntax on page 9 of the tech report
version of the paper.


peter



On 06/20/2018 08:25 AM, Irene Polikoff wrote:
> Thanks Peter.
>
> I see the “user friendliness” of the compact syntax as its main feature.
> Would you agree?
>
> I looked at the paper and compact syntax that may be proposed in it was not
> clear to me. Can you provide some examples?
>
> One issue that I see is that SHACL is very rich and expressive. There is
> typically a conflict between rich/expressive/comprehensive and simple/easy
> to use. 
>
> It may be that the compact syntax optimized for ease of learning and use
> would not support full expressivity. In principle, multiple compact syntaxes
> could be supported - just like RDF has multiple serializations. However, if
> it was possible to define a syntax that is very user friendly, compact and
> has full expressivity, this would be great.
>
> Here is what I mean by the user friendly syntax. 
>
> Below is a pure, not extended GraphQL schema example:
>
> # A user account
> type User {
>  name: String!
>  age: Int             
>  gender: Gender
>  purchases: [Purchase]
> }
>
> type Purchase {
>  # The internal ID
>  productId: String!  
> }
>
> enum Gender {
>  FEMALE
>  MALE
> }
> The expressivity is less than SHACL - basically, one can describe datatypes
> and some aspects of cardinality constraints.
>
> However, GraphQL has a “directives” extension point. Using it, we can
> define, for example,:
>
> # A user account
> type User {
>  name: String!
>  age: Int               @shape(minInclusive: 18)
>  gender: Gender
>  purchases: [Purchase]
> }
>
> type Purchase {
>  # The internal ID
>  productId: String!     @shape(minLength: 8, pattern: "[0-9]+")
> }
>
> enum Gender {
>  FEMALE
>  MALE
> }
> This would still be valid GraphQL syntax. The extension elements do not
> break standard GraphQL parsers and tools.
>
> The definition above would then be equivalent to the following SHACL shapes
> in Turtle:
> ex:User
>  a sh:NodeShape ;
>  rdfs:comment "A user account" ;
>  sh:property [
>   sh:path ex:name ;
>   sh:datatype xsd:string ;
>   sh:maxCount 1 ;
>   sh:minCount 1 ;
>   sh:order 0 ;
>  ] ;
>  sh:property [
>   sh:path ex:age ;
>   sh:datatype xsd:integer ;
>   sh:maxCount 1 ;
>   sh:minInclusive 18 ;
>   sh:order 1 ;
>  ] ;
>  sh:property [
>   sh:path ex:gender ;
>   sh:maxCount 1 ;
>   sh:node ex:Gender ;
>   sh:order 2 ;
>  ] ;
>  sh:property [
>   sh:path ex:purchases ;
>   sh:node ex:Purchase ;
>   sh:order 3 ;
>  ] .
>
> ex:Purchase
>  a sh:NodeShape ;
>  sh:property [
>   sh:path ex:productId ;
>   sh:datatype xsd:string ;
>   sh:description "The internal ID" ;
>   sh:maxCount 1 ;
>   sh:minCount 1 ;
>   sh:minLength 8 ;
>   sh:pattern "[0-9]+" ;
>   sh:order 0 ;
>  ] .
>  
> ex:Gender
>  a sh:NodeShape ;
>  sh:in ( "FEMALE" "MALE" ) .
> We have this working already and in use with extensive models that contain
> thousands of shapes.
>
> Regards,
>
> Irene
>
>> On Jun 19, 2018, at 2:45 PM, Peter F. Patel-Schneider
>> <pfpschneider@gmail.com <mailto:pfpschneider@gmail.com>> wrote:
>>
>> The paper "Semantics and Validation of Recursive SHACL"
>> by Julien Corman, Juan L. Reutter, and Ognjen Savković has the beginnings
>> of a compact 
>> syntax for SHACL.   It looks quite good to me.
>>
>> An extended version of the paper is available at
>> https://www.inf.unibz.it/krdb/KRDB%20files/tech-reports/KRDB18-01.pdf
>>
>> peter
>>  
>>
>>
>> On 06/19/2018 07:36 AM, Irene Polikoff wrote:
>>> One of the capabilities for SHACL that is not yet standardized is a compact
>>> syntax. As part of the WG effort, a draft of the proposed compact syntax was
>>> developed, but, due to the time constraints, finalizing this work was deemed
>>> out of scope and to be addressed in the community group.
>>>
>>> In the last 6 months or so we, at TopQuadrant, have been experimenting with
>>> the use of GraphQL and GraphQL schemas. GraphQL is already widely used and
>>> interest in it is rapidly growing. We see its design and capabilities as
>>> well aligned with SHACL, making it possible (among other things) to use
>>> GraphQL as a compact syntax for SHACL.
>>>
>>> Results of our work will be presented in upcoming
>>> webinars: https://www.topquadrant.com/graphql-webinar/ this Thursday June
>>> 21st (9 am EDT) and also next week, Friday, June 29th (4pm EDT) - 2
>>> timeslots are available to better accommodate different time zones. However,
>>> both webinars will cover the same content.
>>>
>>> If you are interested in this topic, please join the webinars and provide
>>> feedback.
>>>
>>> Regards,
>>>
>>> Irene Polikoff
>>
>

Received on Wednesday, 20 June 2018 16:34:44 UTC