shex icon indicating copy to clipboard operation
shex copied to clipboard

Support for Datasets

Open gkellogg opened this issue 8 years ago • 6 comments

ShEx, like SHACL works over RDF Graphs. There is a need to be able to validate Datasets a well (default plus named graphs). For example, Verifiable Claims is using Datasets for Credentials.

gkellogg avatar Nov 21 '17 15:11 gkellogg

As far as I've seen so far, a language like

<S> {
  :p @<X>
}

<X> GRAPH IRI s/(http:\/\/a.example/some/doc)#someNode/\1/ {
  :p2 .
}

will work, but I'd certainly like to get more feedback.

ericprud avatar Dec 23 '17 20:12 ericprud

Explain the regex bit.

gkellogg avatar Dec 23 '17 20:12 gkellogg

The idea was to be able to fix the graph name with respect to some node. Heretics like myself frequently conflate the node with a graph name. In that case, no transformation is needed. Others are more fastidious about separating the entity from the document about the entity. Here's an access control example allowing <http://accounts.example/Person1#i> to Read <page1>:

<aclsResource> {
  <#acl1> acl:agent <http://accounts.example/Person1#i> ;
          acl:mode acl:Read ;
          acl:accessTo <page1> .
}
<http://accounts.example/Person1> {
  <http://accounts.example/Person1#i> 
    foaf:weblog <http://dig.csail.mit.edu/breadcrumbs/blog/4> .
}

The adminstrator of accounts.example wants to ensure adherence to this #i convention:

<AclShape> {
  acl:agent @<Accounts.ExamplePersonShape> ;
  acl:mode [acl:Read act:Write act:Delete]+ ;
  acl:accessTo IRI
}
<Accounts.ExamplePersonShape> GRAPH IRI s/(http:\/\/a.example/some/doc)#i/\1/ {
  foaf:weblog IRI
}

This says that the triples about an agent (<http://accounts.example/Person1#i>) must be in a graph without the #i (i.e. <http://accounts.example/Person1>). You could also say that it's in a named graph but you don't know the name of it:

<Accounts.ExamplePersonShape> GRAPH . { foaf:weblog IRI }

I can also imagine that someone might have a lookup table from node to authoritative graph but that may be more than we want to stuff into ShEx.

Can you see if this captures Verifiable Claims Use Cases? I can imagine there are more use cases we should be considering. Ideas?

ericprud avatar Dec 25 '17 11:12 ericprud

I had some thoughts about how we might go about doing this:

If there was some syntax to describe a node as representing a name graph, which we could associate with a variable, the shape map might be extended with a graph name entry containing either a URA or such a variable, where the nodeSelector is a triple pattern. This could then push on that graph name to set the current graph to that identified, and proceed with expressions matching with the identified graph for all shape map entries matching the current graph.

gkellogg avatar Apr 12 '18 14:04 gkellogg

I thought this wiki page could get referenced from here https://github.com/shexSpec/shex/wiki/NamedGraphs Does anyone know about any other relevant ideas documented?

elf-pavlik avatar Oct 05 '20 18:10 elf-pavlik

@elf-pavlik , good point. I think you should have write access now.

+1 to call for ideas. Anyone?

ericprud avatar Oct 06 '20 09:10 ericprud