RubenVerborgh / solid-server-architecture

Proposed architecture for a Solid server
https://rubenverborgh.github.io/solid-server-architecture/solid-architecture-v1-3-0.pdf
13 stars 2 forks source link

RDF-aware ResourceStore could probably expose `DataSet.match` to AclBasedAuthorizer #18

Closed michielbdejong closed 4 years ago

michielbdejong commented 5 years ago

The interface of TripleStore on page 4 seems very narrow. In particular, indexing quads and performing queries over them (DataSet.match in rdf.js) would probably have to be implemented a second time inside AclBasedAuthorizer?

RubenVerborgh commented 5 years ago

The interface of TripleStore on page 4 seems very narrow.

Indeed; only methods relevant to LDP are shown. It is expected that TripleStore implements more interfaces, which can be useful for queries. But they don't matter at this point.

indexing quads and performing queries over them (DataSet.match in rdf.js) would probably have to be implemented a second time inside AclBasedAuthorizer?

At the first level, yes. But this is on purpose, since AclBasedAuthorizer needs to work with ResourceStore in general, so also file-based systems like FileSystemStore that do not have native query interfaces.

At the second level, nothing stops us from building a subclass of AclBasedAuthorizer that has an optimization for when the ResourceStore does implement a more expressive interface.

Again, good reason for managing complexity by having dedicated components. Then at runtime, a more specific AclBasedAuthorizer implementation can be chosen without impacting any other component.

RubenVerborgh commented 5 years ago

There's an additional solution path: ResourceStore enables a decorator pattern such that RepresentationConvertingStore can be put in front of another ResourceStore and then to arbitrary conversions.

This was intended for forward conversion as follows. Given a source that only supports raw triple streams, and a request for JSON-LD, then a RepresentationConvertingStore would make a request to that source and use an convertor to transform it into JSON-LD.

However, we could also perform the reverse operation: AclBasedAuthorizer could indicate its preference for raw triples, and RepresentationConvertingStore would then perform any conversion needed.

So then we have a stream of triples, on which the ACL operations are easy to perform. We can just use Comunica to perform the SPARQL query directly on the stream.

RubenVerborgh commented 4 years ago

Resolving this for now; can be reopened if new concerns arrive.