{"action":"opened","issue":{"url":"https://api.github.com/repos/shexSpec/shex/issues/17","repository_url":"https://api.github.com/repos/shexSpec/shex","labels_url":"https://api.github.com/repos/shexSpec/shex/issues/17/labels{/name}","comments_url":"https://api.github.com/repos/shexSpec/shex/issues/17/comments","events_url":"https://api.github.com/repos/shexSpec/shex/issues/17/events","html_url":"https://github.com/shexSpec/shex/issues/17","id":197417123,"number":17,"title":"Support for RDF Collections (lists)","user":{"login":"gkellogg","id":46296,"avatar_url":"https://avatars.githubusercontent.com/u/46296?v=3","gravatar_id":"","url":"https://api.github.com/users/gkellogg","html_url":"https://github.com/gkellogg","followers_url":"https://api.github.com/users/gkellogg/followers","following_url":"https://api.github.com/users/gkellogg/following{/other_user}","gists_url":"https://api.github.com/users/gkellogg/gists{/gist_id}","starred_url":"https://api.github.com/users/gkellogg/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/gkellogg/subscriptions","organizations_url":"https://api.github.com/users/gkellogg/orgs","repos_url":"https://api.github.com/users/gkellogg/repos","events_url":"https://api.github.com/users/gkellogg/events{/privacy}","received_events_url":"https://api.github.com/users/gkellogg/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2016-12-23T19:28:51Z","updated_at":"2016-12-23T19:28:51Z","closed_at":null,"body":"In doing the RDFS for ShEx, it was necessary to separate the properties `expression` and `expressions`, as `expressions` is expected to take a list of `TripleExpression`, while `expression` takes a single value. Furthermore, `expressions` **must** have at least two elements. How would we create a shape to validate this?\r\n\r\nCertainly, one way is to use the `rdf:first` and `rdf:rest` properties:\r\n\r\n```\r\nPREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>\r\nPREFIX shex: <https://shexspec.github.io/ns/>\r\nPREFIX ex: <http://schema.example/>\r\n\r\nshex:EachOf CLOSED {\r\n  rdf:type shex:EachOf;\r\n  shex:expressions BNODE @ex:ListOfTwoExpressions;\r\n}\r\n\r\nex:ListOfTwoExpressions CLOSED {\r\n  rdf:type rdf:List?;\r\n  rdf:first @shex:TripleExpression;\r\n  rdf:rest {\r\n    rdf:first @shex:TripleExpression;\r\n    rdf:rest @ex:ListOfExpressions;\r\n  }\r\n}\r\n\r\nex:ListOfExpressions CLOSED {\r\n  rdf:type rdf:List?;\r\n  rdf:first @shex:TripleExpression;\r\n  rdf:rest [rdf:nil] OR @ex:ListOfExpressions;\r\n}\r\n\r\nshex:TripleExpression {\r\n  rdf:type shex:OneOf OR shex:EachOf OR shex:Inclusion OR shex:TripleConstraint;\r\n}\r\n```\r\n\r\nBut, for what seems like such a common pattern, this is pretty heavy weight. One thought I had was to add a new node kind `LIST`, which would serve dual purposes of verifying that the property value was a valid RDF Collection, and would also alter value and cardinality checking. The shape might look something like the following:\r\n\r\n```\r\nPREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>\r\nPREFIX shex: <https://shexspec.github.io/ns/>\r\nPREFIX ex: <http://schema.example/>\r\n\r\nshex:EachOf CLOSED {\r\n  rdf:type shex:EachOf;\r\n  shex:expressions LIST @shex:TripleExpression{2,}\r\n}\r\n```\r\n\r\nThe downside of this is that we are overloading `nodeKind` to allow for modifying other behavior in the TripleConstraint. Also, we can't talk about both the cardinality of a list, and the cardinality of the number of lists that should be property values in the TripleConstraint (which I think is really of only theoretical utility, but ...).\r\n\r\nEric came up with something that extends the grammar to look something like the following:\r\n\r\n```\r\nPREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>\r\nPREFIX shex: <https://shexspec.github.io/ns/>\r\nPREFIX ex: <http://schema.example/>\r\n\r\nshex:EachOf CLOSED {\r\n  rdf:type shex:EachOf;\r\n  shex:expressions LIST(@shex:TripleExpression{2,}){1,3}\r\n}\r\n```\r\n\r\nwhich would not use a node kind, but a new `LIST` functional syntax, so you could say the `shex:expression` must have at least one and no more than three distinct lists, each one of which must have at least two entries with the shape `shex:TripleExpression`.\r\n\r\nPersonally, I think overloading `nodeKind` works well, and if someone really has a need to talk both about cardinality of lists as well as list elements, they can fall back to `rdf:first/rest` primitives."}}
{"actor":{"display_login":"gkellogg"}}