shexSpec / shex

ShEx language issues, including new features for e.g. ShEx2.1
25 stars 8 forks source link

Support for Datasets #77

Open gkellogg opened 7 years ago

gkellogg commented 7 years ago

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.

ericprud commented 6 years ago

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.

gkellogg commented 6 years ago

Explain the regex bit.

ericprud commented 6 years ago

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?

gkellogg commented 6 years ago

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.

elf-pavlik commented 4 years ago

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?

ericprud commented 4 years ago

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

+1 to call for ideas. Anyone?